The topic of compiling J to WASM came up in conversation recently. This is
the past work in the area I'm aware of:

WASM (Web Assembly) is a modern standard for running sandboxed native code,
especially in web browsers.

It evolved out of attempts to transpile C code to a reduced subset of
javascript that could be heavily optimized by the developers of javascript
engines.

Anyway, it looks like Joe Bogner had this working through emscripten
(c->js/wasm compiler) circa 2014:

https://code.jsoftware.com/wiki/NYCJUG/2014-12-09#Emscripten_Version_of_J

It's still running online, and you can try it here:

http://joebo.github.io/j-emscripten/

It looks like the changes necessary to make J7 compile under emscripten
were rather minimal:

https://github.com/joebo/j-emscripten-src/commit/32088fe4f89ac2a13b82e73dffdb756fea2152ab

Then again, it only includes some basic parts of j.. .for example, trying
to run (4!:1)''
(nl) to see what has been defined results in a `missing _jtnl1` error... As
far as i can tell, it only includes primitives, not predefined names.

So my guess is if someone wanted to put the effort in, it wouldn't be too
hard to get this working for j9, but then the trick would be filling in the
gaps and figuring out how to load the standard library... And then probably
a lot of design decisions about exactly what API to expose to the host
environment (javascript).
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to