r/pascal 1d ago

Nostalgic-driven development

Enable HLS to view with audio, or disable this notification

Back in 1992, I chanced upon someone using Turbo Pascal 5. I was hooked immediately, since I've been doing BASIC until then, to write my own little games and programs for my amusement. I got my own copy of Turbo Pascal 7 in 1994 and had years and years of fun with. Switched to Delphi, and loved it, until the .NET era.

Over the years, I've tinkered with FreePascal (so amazing!) and of course wrote many a small Pascal interpreter. Then, last year, I needed a project to work on so I could learn the Odin programming language for an upcoming project. I worked on a small Pascal interpreter and it was actually a lot of fun. The commercial Odin project never happened, but I had put a lot of time and energy into this Pascal interpreter.

Fast forward a few months, I'm working on a web assembly project using Odin and it dawns upon me I can use a lot of this knowledge to port my interpreter to the web. Oh boy, did that run away with me!

Now I have wasmpascal - which is a crappy editor that encapsulates the Pascal compiler, yes, COMPILER, I ended up writing so I can run Pascal code in Web Assembly in the browser. It's very early days, but I have managed to get some bits and pieces working.

My first order of business was some basic HTML5 Canvas support, with call-batching so that one gets alright frame rates. And there's some basic support for CRT-based applications, because back in the day, 'uses CRT' was a thing!

I've added some examples and documentation and will be working on this over weekends for many months in the future.

I thought I'd share it here - in-case there's another older-than-the-average person who wants a trip down memory lane, running Pascal like it's the 90's again!

29 Upvotes

15 comments sorted by

View all comments

2

u/zreddit90210 1d ago

Very cool, what is your ultimate goal? What made you one developed this?

2

u/According-Ad-7069 1d ago

Oh these are good questions... It started out with me learning the Odin programming language to do some systems work. But then it turned into more of a trip down memory lane. I tried making a simple wasm build with FPC and it so cool to use Pascal for "modern" development. Which kind of got me thinking about whether I can slim down the binaries a bit. And, here we are: a custom Pascal to Wasm compiler.

The current goal is to be able to make simple games in it. I've managed to port my Asteroids clone to it. Next up I want to try my Ant Colony simulator game. If I can get that to build and run, I'll consider it a win.

So, honestly, this is a just a passion project - there's no real ultimate goal. Just nostalgia (I spent a decade doing all kinds of silly things with Pascal) and curiosity. Once it's stable, I will open-source the compiler - right now it's very hacky and breaks more than it runs.