QuickJS is also fantastic, but not anywhere near Elk in terms of size. Elk is ~59k (1300 lines) of C code, and has some limitations (like no for loops, for example) that I assume were traded off so it could run on things like the 2K RAM / 30K flash Atmel shown in the article.
QuickJS is small compared to say, V8, but quite a lot larger than Elk. Just the main C source file for QuickJS is ~1.7MB, and there's several other source files.
This part of the code hints at what else is left unimplemented:
case TOK_CASE: case TOK_CATCH: case TOK_CLASS: case TOK_CONST:
case TOK_DEFAULT: case TOK_DELETE: case TOK_DO: case TOK_FINALLY:
case TOK_FOR: case TOK_IN: case TOK_INSTANCEOF: case TOK_NEW:
case TOK_SWITCH: case TOK_THIS: case TOK_THROW: case TOK_TRY:
case TOK_VAR: case TOK_VOID: case TOK_WITH: case TOK_YIELD:
res = js_err(js, "'%.*s' not implemented", (int) js->tlen, js->code + js->toff);
break;
So that's quite a lot of the language I guess, but it does say that it's a sub-set so of course that's fine. Very impressive code, it really shows that the developer has an eye to minimizing the memory footprint. I was fooled for a couple of seconds by the init call:
Since it really "feels" like a function that creates a struct instance on the heap, but of course it does not: it's created inside the working memory passed in (so if it works, js == mem).
QuickJS is small compared to say, V8, but quite a lot larger than Elk. Just the main C source file for QuickJS is ~1.7MB, and there's several other source files.
Just saying they seem to be in different niches.