Building a JavaScript Runtime from Scratch using C

redbell | 49 points

How about a formally verified runtime that takes the JS spec & constructs a runtime by converting the spec w/ incremental & verifiable transformations into an executable runtime?

measurablefunc | an hour ago

This could useful to reference for when you want to put a JavaScript interpreter in your own custom software. For example I've seen JavaScript used for console game UI systems.

djmips | 3 hours ago

This is not "Building from scratch" This is just using.

yb303 | 4 hours ago

I guess I would like to see defining your global object in a real use case and adding some functions to your global object that make sense, which admittedly once you ask someone to do the creative work of making a use case that is sensible as they start implementing it they might find it is more useful to complete the implementation of that use case rather than releasing a starter tutorial.

bryanrasmussen | 5 hours ago

For those who would like a true "from scratch" implementation of JavaScript, Fabrice Bellard's QuickJS [1] is clean, readable and approachable. It's a full implementation of modern JavaScript in a straightforward project, not nearly as complex or difficult as V8.

[1] https://bellard.org/quickjs/

claytongulick | 3 hours ago

I was a little disappointed that this was “just” a wrapper for JavaScriptCore.

TheCleric | 5 hours ago

unpopular comment : v8 > JavaScriptCore.

lerp-io | 4 hours ago