The example with ESP32 is quite, the hardware is much more powerful than pre-Windows PCs, so why pretend it is something where C and Assembly are the only answer, when MS-DOS had plenty of languages to chose from.
* Lua already exists and is better suited to this
* JS is a relatively complicated language to evaluate
* JS requires a large amount of dynamic allocation
* JS isn't really the first thing (or in the top 25 things) I would pick when developing on a platform where I wasn't already stuck with it
Forth is at that size. Tcl implementations are at least triple that. As are all the Schemes I have seen. Lua similarly.
Anything I've missed?
Literally just yesterday I was trying to find the equivalent for Java, byte code or otherwise. I want to attempt to run several nano JVM apps on an ESP32, but I'm starting to think that it might not be possible.
Many years ago now I ran a custom 'script runner' that fit into 512 bytes of assembly language for a custom kernel (that was also 512 bytes) [1]. I would really like to play with something like Elk and see what can be done!
[1] https://bitbucket.org/danielbarry/saxoperatingsystem/src/mas...
Don't get me wrong, this is a cool project, but I don't see why you would ever choose to use JS in an embedded context except for fun. The arguments for using lua or micropython are already very narrowly applicable.
I was just looking at the Java bytecode and thinking "in theory, one could build a small JVM for this" [1]. But it still looks like an enormous effort to build, test and then use in a meaningful way.
[1] https://en.wikipedia.org/wiki/Java_bytecode_instruction_list...
https://www.microej.com/product/sdk/
https://developer.microej.com/supported-embedded-runtime-arc...
I did see microej but I'm specifically interested in open-source - and from what I can tell this is some kind of paid service. I didn't look particularly close though [1]. The ESP32 device they do support appears to be a very specific development kit [2].
[1] https://github.com/MicroEJ
[2] https://github.com/MicroEJ/Platform-Espressif-ESP-WROVER-KIT...
Totally on topic. I dislike JS but this is rad. And like upthread said, clean understandable implementation. Very educational.
Embedded development is the bat country of software. You will definitely have to do some unsavory things to get where you're trying to go.