* 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
One of the top listed features of this interpreter is a fixed memory footprint
- JS is a relatively complicated language to evaluate
In developing this interpreter they eliminated some of the languages features to make it simpler.
That means you can't run general-purpose code safely, which means you should probably write/rewrite/adapt it, which means you might as well use a different language.
I'm a JS developer, but the parent might have a point here. Why run something like this in production when you're likely to end up in unexpected situations? Either a runtime is compliant, or you're going to have a bad time.
The project is cool, but I wouldn't use it as an example for what JS can do.
In embedded systems that is often a necessity but calling it a feature instead of a constraint is a good idea.
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.
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.
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...
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...
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.