Hacker News new | past | comments | ask | show | jobs | submit login
A Forth to Scratch compiler (scratch.mit.edu)
71 points by CarolineW on Feb 4, 2017 | hide | past | favorite | 7 comments



There are quite a few interesting transpilers involving Scratch. For example, https://phosphorus.github.io/ lets you transpile Scratch code to JavaScript for improved performance.

Other projects of note are an LLVM frontend for Scratch:

https://github.com/bobbybee/scratch86

And a corresponding backend:

https://github.com/bobbybee/scratch-llvm


Compiling to JavaScript to improve performance? There's something new


It is nice to see the recent rise of posts about FORTH. It's a language I first played with back on the 48k ZX Spectrum in the late nineties.

When I first used it I loved the way you could redefine the language, at run-time in the REPL. These days I just love the purity and cleanliness of the language.

I don't have a single compelling use-case for it, but over the years I've written my own implementation in C, Java, and Perl.

Having recently started playing with hardware it is nice to see you can even run it on ESP8266 / Arduino hardware.


Very timely remark :) Take a look at what jcw (of tclkit fame) is doing:

http://jeelabs.org/2017/02/various-shades-of-forth/


Thanks for the link, they were indeed timely pieces!


It looks like it might be a nice language to write stuff for the GBA with.

Or the GB/CGB, for that matter, but space is much more limited there.


This project completely misses the point of Forth.

Forth is an interactive assembler. This one has no REPL.

Control structures are easy to introduce in the Forth itself because IF, ELSE and THEN are separate "immediate" words that just manipulate the return stack and compile some branching code immediately when parser encounters them. This compiler has no return stack at all and just looks for IF..ELSE..THEN during parsing.

Forth is ugly outside but has beautiful implementation. This compiler is some ugly python code inside.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: