thelastpsion, to retrogaming
@thelastpsion@bitbang.social avatar

Current projects:

▶️ #CTRAN: A drop-in FOSS replacement for CTRAN.EXE, the #Psion SIBO/EPOC16 OO C preprocessor on #DOS. Almost feature complete, but still work to do!
▶️ #ObjectPascal with #FreePascal: Used for CTRAN for easy development and portability. Honestly, I'm really enjoying it; it fits my needs and makes my brain happy.
▶️ RAM upgrade for 3mx to 4MB: Trying to source old DRAM isn't easy.
▶️ RAM upgrade for 5mx: Got the DRAM. Just need to solder it in place.

#RetroComputing

thelastpsion, to neovim
@thelastpsion@bitbang.social avatar

Thoughts on 3 months of usage (in ):

  • Easy to pick up and read
  • Good libraries
  • Generics
  • No closures
  • Binaries aren't small
  • LSP (pasls) isn't complete, but better than nothing; + really help
  • Docs are frustrating
  • Good forums/community
  • Targets SO MANY platforms (, 32-bit , , , )! More than Rust, Go
  • A lot of historic books and projects

Would I use again? Absolutely yes, without doubt.

thelastpsion, to retrogaming
@thelastpsion@bitbang.social avatar

Just tried compiling Wari, a game written in #Psion OO C. The project uses #Borland Make 3.6.

Got it to compile first time with my SIBO SDK setup - all good!

However... Borland Make uses 16-bit DPMI, and its extender won't load 32-bit DPMI binaries. If I pre-load the 32-bit extender, it won't load 16-bit DPMI binaries, so Make won't run!

TL;DR: I can't use the new #ctran with Borland Make 3.6.

Looks like I'll be converting that Makefile to GNU Make or a #TopSpeed project.

#dos #dosbox

thelastpsion,
@thelastpsion@bitbang.social avatar

Why can't I recompile #ctran for 16-bit #DOS? Because many of #FreePascal's libraries are too big to fit into 64 KiB data blocks, and won't compile no matter which memory model I use.

There is a chance I'll rewrite ctran in the future. #FreeVision (the #Borland #TurboVision "clone") with #ObjectPascal is certainly an option. I could also rewrite the lot in C or C++.

But today is not that day. For now, I'd rather just rewrite a Makefile.

#dosbox #retrocomputing

thelastpsion, to random
@thelastpsion@bitbang.social avatar

Done a lot of work on #ctran tonight. In fact, I think we might have a working parser! I definitely need to check over what I've done, but it's looking promising.

I need to add more checks to make sure that tokens don't appear in files that aren't meant to have them (e.g. DECLARE should only be in .EXT files). Then I need to test that the tree is being built the way I think it is.

After that, it's time to do something with EXTERNALs and REQUIREs to make MANY trees.

thelastpsion,
@thelastpsion@bitbang.social avatar

If you're interested in how I've done this, the code is here:

https://github.com/PocketNerdIO/ctran

Be warned, though. It's a mess. Right now my aims are "having working code" and "learning Pascal" rather than "pretty."

thelastpsion,
@thelastpsion@bitbang.social avatar

I guess I could create a dynamic array of parser classes?

Is that something I can do in #ObjectPascal? Is it even a good idea?

Thoughts for another time. For now, it's time to check I've pushed all my commits, and head to bed.

#FreePascal

thelastpsion,
@thelastpsion@bitbang.social avatar

So, to come on :

⬜ Move a load of "testing" code to a separate class, inheriting the main class.
⬜ Remove the old public token-grabbing methods. They were for the old parser, so aren't needed.

The first one should be relatively simple (I think). I've not tried inheritance in classes yet, so we'll see how things go. Hopefully it doesn't make me want to refactor everything as one or more interfaces.

thelastpsion,
@thelastpsion@bitbang.social avatar

Mmm... Shiny #DOS goodness alongside shiny #Linux goodness.

Exactly the same #ObjectPascal code on both, just using #FreePascal's cross-compiler for 32-bit DOS. Zero changes needed.

#ctran

image/png

SciPasTips, to random
@SciPasTips@fosstodon.org avatar

Issue #110/11 of Blaise Pascal Magazine: Machine-learning in #ObjectPascal with a convoluted neural network, stepping with the #Lazarus debugger, using Lazarus with #Delphi and Visual Studio etc. https://blaisepascalmagazine.eu

thelastpsion, to random
@thelastpsion@bitbang.social avatar

Musing on #ctran.

I'm starting to wonder if there's any point in having the lexer and parser as two separate classes.

Other than testing, the lexer is only ever going to be called by the parser, and only once during the process.

It might be better to just have a lexer-parser class that grabs a file, tokenises it, then (if it's happy with the file it's tokenised) immediately turns it into a tree.

Is there a really good reason why they should be separate classes?

#compiler #objectpascal #oop

thelastpsion, to random
@thelastpsion@bitbang.social avatar

Been thinking about #ctran and ASTs today. I've realised that I might be approaching this wrong.

#Psion OO C files are definition files. They're glorified mark-up, wrapping around snippets of C code that just gets copied to new files. There's no logic in them at all.

I basically need two arrays per file: a list of "classes" and their contents, and a list of "includes" and how they're, uh, included (EXTERNAL, INCLUDE, or REQUIRE).

It's still a tree, but it's got two distinct parts. Wonky tree.

thelastpsion,
@thelastpsion@bitbang.social avatar

Actually, I wonder if variant records would be useful for building a tree, or at least an array containing elements of different types? Need to read up on them.

#FreePascal #ObjectPascal

thelastpsion, to VintageOSes
@thelastpsion@bitbang.social avatar

Interesting... I'd assumed that #FreePascal's 16-bit #DOS cross-compiler was just ignoring the memory model I was setting. Turns out it wasn't, and I hadn't been reading the error messages properly. They're all failing for different reasons!

Surely I must be doing something wrong?

I'm struggling to find any information on issues like this, largely because hardly anyone uses it.

I might end up switching to the 32-bit DOS compiler, just to get something working.

#MSDOS #retrodev

thelastpsion,
@thelastpsion@bitbang.social avatar
thelastpsion,
@thelastpsion@bitbang.social avatar

So, I've got two relatively big problems to solve.

  • Ripping out TStringList() so that I can remove the Classes unit. I'm going to switch to per-character parsing anyway, so that's fine.
  • How do I build an AST in ? More to the point, how do I build it without any nice-to-have libraries that will probably be too big to fit in 64K?

I think I build it with the nice stuff first so I understand what it's doing, and then rebuild the nice stuff from scratch, or build it better without.

SciPasTips, to random
@SciPasTips@fosstodon.org avatar

The Apple Macintosh has turned 40. Originally, it was a machine, and has been developed to evolve its revolutionary operating system.

Mac SE with source code in THINK Pascal.

thelastpsion, to random
@thelastpsion@bitbang.social avatar

#CTRAN currently has a lot of repetitive code in the #tokeniser. I really want to refactor it so that it's both tidier and more readable. I also know that I'm going to need to reuse a lot of the tokeniser code to process #Psion's .EXT files, which are a sort of cut-down version of the class/category files.

I'm in a position where the tokeniser works well, so I think I can afford to shift things around. I think it's time to put the tokeniser in a class.

#ObjectPascal #FreePascal

thelastpsion,
@thelastpsion@bitbang.social avatar

Well, the tokeniser is now in a class and still works! Procedures and functions have been pulled in and simplified, and private things are strict private. Tidying the code will now be much easier.

Have a look at the code so far on GitHub. Feel free to critique - I know there's much to be improved, but I could have missed something.

https://github.com/PocketNerdIO/ctran

#ctran #Psion #ObjectPascal #FreePascal

thelastpsion, to random
@thelastpsion@bitbang.social avatar

#ObjectPascal can load an entire file into memory as a TStringList, automatically splitting files into separate lines.

Is that cheating? Because it feels like cheating.

I'm going to give it a try.

SciPasTips, to random
@SciPasTips@fosstodon.org avatar

A novel method for early detection and of mellitus relies on software written in .

Today, this innovative approach is covered by all major press agencies and news channels all over the globe.

https://news.rub.de/english/press-releases/2024-01-19-medicine-simple-and-reliable-early-prediction-diabetes

thelastpsion, to random
@thelastpsion@bitbang.social avatar

"Modern Introduction for Programmers"

https://castle-engine.io/modern_pascal

Thank you to @rvr for sending me this. I've had a quick read through and it looks to be exactly what I need. Especially the section "7.2. Containers (lists, dictionaries) using generics".

thelastpsion, to neovim
@thelastpsion@bitbang.social avatar

It's taken me a couple of hours to get an #LSP for #Pascal working in #NeoVim on Linux, but we're there!

I will document this (I need to do it again for the laptop), but in short:

  • Install Lazarus 3.0.0 beta
  • Get latest Lazarus trunk source
  • git clone the LSP source
  • Fix an issue with LSP source that's in an unmerged pull request
  • Build the LSP as per README
  • Set a couple of env variables
  • Copy the pasls binary to your path
  • Add zero-lsp.nvim plugin
  • enable pasls in zero-lsp config
thelastpsion,
@thelastpsion@bitbang.social avatar
thelastpsion, to retrocomputing
@thelastpsion@bitbang.social avatar

OK, the new sidequest...

I've decided to rewrite CTRAN, the #Psion OO C preprocessor from the SIBO C SDK.

In #FreePascal.

And this time I've actually written some code.

https://github.com/PocketNerdIO/ctran

#RetroComputing #RetroDev #Pascal

thelastpsion,
@thelastpsion@bitbang.social avatar

#FreePascal compiles for almost everything (See the picture), including 16-bit DOS.

It's also still maintained, with an active community.

Using #ObjectPascal (which is basically what Free Pascal is), I can get the logic written for a lexer, an AST, and then a few code generators, without worrying about how I'm going to allocate memory for an array, let alone an entire tree.

victorp, to python

The TIOBE Programming Community index is an indicator of the popularity of programming languages. This ranking is organized according to their popularity as of Sep 2023:
(1) Python
(2) C
(3) C++
(4) Java
(5) C#
(6) JavaScript
(7) Visual Basic
(8) PHP
(9) Assembly Language
(10) SQL
(11) Fortran
(12) Go
(13) MATLAB
(14) Scratch
(15) Delphi/Object Pascal
(16) Swift
(17) Rust
(18) R
(19) Ruby
(20) Kotlin

https://www.tiobe.com/tiobe-index/

#Sep2023 #Sep2022 #Change #ProgrammingLanguage #Ratings #Python #C++ #C# #Java #C #JavaScript #VisualBasic #PHP #AssemblyLanguage #SQL #Fortran #Go #MATLAB #Scratch #Delphi #ObjectPascal #Swift #Rust #R #Ruby #Kotlin

  • All
  • Subscribed
  • Moderated
  • Favorites
  • megavids
  • thenastyranch
  • rosin
  • GTA5RPClips
  • osvaldo12
  • love
  • Youngstown
  • slotface
  • khanakhh
  • everett
  • kavyap
  • mdbf
  • DreamBathrooms
  • ngwrru68w68
  • provamag3
  • magazineikmin
  • InstantRegret
  • normalnudes
  • tacticalgear
  • cubers
  • ethstaker
  • modclub
  • cisconetworking
  • Durango
  • anitta
  • Leos
  • tester
  • JUstTest
  • All magazines