Port asm.js target to more engines
I have no idea how the various JS engines interface to the operating system. Or how to run this in a browser.
What are the major engines?
- SpiderMonkey, TraceMonkey?, JägerMonkey?; just how many monkies?? Odin, Ion, ...
- Rhino? In Java? Is that useful?
- V8, yay Scandinavia!
- Node, based on V8
- Nitro, SquirrelFish?
- Chakra
I don't know too much about the non-SpiderMonkey engines, but the current code should work under IonMonkey, the Baseline compiler, and the SpiderMonkey JS interpreter, though I say that without having tested it. Node.js has its own OS interface, which makes it hard to read input synchronously; V8 has a shell with a minimal OS interface similar to what SpiderMonkey offers.
I think the interesting target is the browser environment, ideally using only W3C APIs, but there is at least one obstacle: asynchronous APIs (and they all are) require control to pass back and forth between the Forth interpreter and the JavaScript top level. Nothing too hard to do, but a bit fiddly.
I've got a very WIP WebAssembly backend displaying "ok". (This is literally the first version that passes my sophisticated "3 4 * ." test.) Ideally, this should share some code with the asm.js backend. (Code at https://github.com/pipcet/lbForth/tree/wasm).
Nothing too hard to do, but a bit fiddly.
Okay, I've got something working with nodejs at https://github.com/pipcet/lbForth/tree/asynchronous-js. I'll try to turn that into "official" nodejs support next.