3 ms·
I totally appreciate the effort, but without a runtime parser you're essentially compiling the JS to another language, and then running it with a non-standard e
by aliswe 4y ago
I totally appreciate the effort, but without a runtime parser you're essentially compiling the JS to another language, and then running it with a non-standard engine?
Couldnt we simply compile a JS file through eg LLVM to a normal binary, in that case?
- jpgvm 4y agoNot really. It's using a bytecode IR (intermediate representation). An IR is effectively a mid-point between JS and machine code. The benefit of using it is a) it's generally executable by the interpreter with minimal processing b) it's still architecture independent so you can ship the same bytecode to multiple different MCUs. Fundamentally though it's just JS in a different representation rather than a "different language". You probably could generate machine code directly. You can do this already (but generating large binaries unsuitable for embedded) with tools like GraalVM/SubstrateVM. It's actually a fairly difficult problem though due to nature of escape analysis and other things needed to compile highly dynamic languages efficienty.