GrammaticalFramework / gf-core

Grammatical Framework core: compiler, shell & runtimes
https://www.grammaticalframework.org
Other
129 stars 35 forks source link

Compile C runtime to Web Assembly using Emscripten #143

Open johnjcamilleri opened 2 years ago

johnjcamilleri commented 2 years ago

@krangelov has found out how to make the C runtime code compiling to JavaScript Web Assembly using Emscripten. The next step is to test if it works correctly and build some high-level bindings around them, hence this branch. This pull request is an extreme work-in-progress, but I'm creating it to act as the central thread for discussing this work.

johnjcamilleri commented 2 years ago

Current status:

RuntimeError: Aborted(native code called abort()) at abort (/Users/john/repositories/GF/gf-core/src/runtime/javascript/.libs/pgf.js:927:11) at _abort (/Users/john/repositories/GF/gf-core/src/runtime/javascript/.libs/pgf.js:3709:7) at wasm://wasm/00042f8e:wasm-function[80]:0x5b8c at wasm://wasm/00042f8e:wasm-function[243]:0xef26 at wasm://wasm/00042f8e:wasm-function[241]:0xe8a9 at wasm://wasm/00042f8e:wasm-function[244]:0xefc4 at wasm://wasm/00042f8e:wasm-function[240]:0xe59e at wasm://wasm/00042f8e:wasm-function[248]:0xf0c6 at Object._pgf_read (/Users/john/repositories/GF/gf-core/src/runtime/javascript/.libs/pgf.js:971:22) at Object.readPGF (/Users/john/repositories/GF/gf-core/src/runtime/javascript/jspgf.js:44:28)



WASM uses it's own filesystem, and I am making sure to copy the PGF file into it first (when I don't I correctly get a file not found error). As far as I can tell the copying itself works, and I am stumped as to what could be the cause of this error.