Can you compile JavaScript to ARM assembly? I'm learning JavaScript right now and I want to know if there is a way to compile it to ARM assembly (to make a GBA/DS game) without writing something in another programming language.
CodePudding user response:
Ahead-of-time compile, not that I know of. JS is a dynamic language that even supports constructs like eval()
of a string, so a hypothetical compiler would still have to embed an interpreter or JIT runtime into the executable. It's also a managed language (sandboxed, and with garbage collection).
node.js
will JIT to native machine code on the fly, for architectures the V8 engine supports. But I don't think this will help you make a GBA game, since you'd need to port node.js to the GBA, and have some native libraries to do machine-specific stuff I guess. A quick search finds some GBA emulators written in JS (to run under node.js); I think it's unlikely that you'd find the other thing, a port of node.js to run in a GBA.