waforth/experiments/waforth2c
2019-11-08 16:19:47 +01:00
..
examples Add experimental Forth->C compiler 2019-03-09 13:48:22 +01:00
wasm2c Add experimental Forth->C compiler 2019-03-09 13:48:22 +01:00
.gitignore Add experimental Forth->C compiler 2019-03-09 13:48:22 +01:00
main.c Add experimental Forth->C compiler 2019-03-09 13:48:22 +01:00
Makefile waforth2c: Remove binaryen dependency. 2019-03-09 13:48:22 +01:00
README.md Add experimental Forth->C compiler 2019-03-09 13:48:22 +01:00
waforth.c shell.key->shell.getc 2019-03-12 09:04:39 +01:00
waforth.h Add experimental Forth->C compiler 2019-03-09 13:48:22 +01:00
waforth2c.js Remove prelude 2019-11-08 16:19:47 +01:00

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

  1. Create a .f file with a main word defined (e.g. example/sieve.f)

  2. Compile

     ./waforth2c.js examples/sieve.f
    

    This will generate .wasm files for all the defined words.

  3. Build

     make
    

    This will generate .c files from the .wasm files generated in 2., and build them using the C compiler.

  4. Run

     ./main