3 ms·
Here's some ideas about WASM forth I wrote about previously: https://news.ycombinator.com/item?id=34374057 https://news.ycombinator.com/item?id=34374057 >This
by DonHopkins 3y ago
Here's some ideas about WASM forth I wrote about previously:
https://news.ycombinator.com/item?id=34374057 https://news.ycombinator.com/item?id=34374057
>This is a great article! I love his description of Forth as "a weird backwards lisp with no parentheses".
>Reading the source code of "WAForth" (Forth for WebAssembly) really helped me learn about how WebAssembly works deep down, from the ground up.
>It demonstrates the first step of what the article says about bootstrapping a Forth system, and it has some beautiful hand written WebAssembly code implementing the primitives and even the compiler and JavaScript interop plumbing. We discussed the possibility of developing a metacompiler in the reddit discussion.
[...]
Check out this beautiful hand written wasm code, a dynamic wasm based Forth compiler:
https://github.com/remko/waforth/blob/master/src/waforth.wat https://github.com/remko/waforth/blob/master/src/waforth.wat
It compiles new Forth words into teenie tiny little wasm modules, and hooks out through JavaScript in the browser to create and link them in to the main module, so it can call the code it just compiled. Wasm doesn't let you modify compiled code, but you can compile new code and link it in and execute it!