Quantcast
Channel: Hacker News
Viewing all articles
Browse latest Browse all 25817

A Forth to Scratch compiler

$
0
0
I have implemented a FORTH-interpreter/compiler that can run the kinds of code Scratching Forth generates, but not exactly, but it could be modified.
https://scratch.mit.edu/projects/137676871/
These codes are in the sprite Compiled.

Read an article about the FORTH here: https://scratch.mit.edu/discuss/topic/233532/
The instructions and notes on the project page are more updated, but the article is probably easier to read (I will update the article for newer versions).

There is another topic about FORTH here, and my FORTH can run the compiled code from the mentioned repository:
https://scratch.mit.edu/discuss/topic/213122/

It was very fun and educational to write a compiler in Scratch and from Scratch. I didn't look at any compiler code and just implemented the functions required for each chapter in the book Starting FORTH (it still misses file management and string functions). This FORTH-compiler was my first compiler. My first interpreter was PocketCalc: https://scratch.mit.edu/projects/13110194/

This FORTH has pen and noteblocks, and some other Scratch-specific features.


Viewing all articles
Browse latest Browse all 25817

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>