Awesome
Forth on WASM
This repo (sort of) runs a Forth interpreter natively (no transpilation!) in any browser that supports Web Assembly. The Forth interpreter (the part written in C) was originally authored by Leif Bruder in 2014 under a public domain license. Thanks, Leif!
It sort of works, but unfortunately, causes the browser to hang. I would really like to know why, but have yet to find a cause.
Issues
forth.c
runs great on Linux x64 viagcc
. Seeforth_native_exe
to try it on your own machine. The source was compiled viagcc forth_native.c -o forth_native_exe
. I only had to change the original source in two places to compile native vs. WASM (relates to cell size).- When compiling
forth_wasm.c
to binary (see:program.wasm
andindex.html
) via WASM Fiddle, the program sort-of-kind-of runs. The problem is that it does not pause and freezes the browser tab on both Chrome and Firefox.
How to Replicate
- (optional) Run
forth_native_exe
on a Linux machine. Notice that it does not crash. - Open
index.html
in Chrome. Notice that it crashes. This link will cause your tab to hang, probably. - Open
index.html
in Firefox. Notice that it crashes. This link will cause your tab to hang, probably.
...does anyone have any ideas as to why?
License
forth.c
is licensed as public domain software. All other code is licensed under the MIT license.