mirror of
https://github.com/remko/waforth
synced 2024-12-27 09:59:29 +01:00
.. | ||
examples | ||
wasm2c | ||
.gitignore | ||
main.c | ||
Makefile | ||
README.md | ||
waforth.c | ||
waforth.h | ||
waforth2c.js |
WAForth2C: Experiment to use WAForth to convert Forth to C
Uses WAForth to generate WebAssembly modules, passes them to wasm2c
, and
compiles and loads everything together into a native binary.
Usage
-
Create a
.f
file with amain
word defined (e.g.example/sieve.f
) -
Compile
./waforth2c.js examples/sieve.f
This will generate
.wasm
files for all the defined words. -
Build
make
This will generate
.c
files from the.wasm
files generated in 2., and build them using the C compiler. -
Run
./main