HACKER Q&A
📣 randomlytyping

I want to write a JavaScript engine from scratch, where should I start?


I read most of the documentation online from the main engines (V8, QuickJS mainly), and understood the job of an engine and everything and his main components etc... but still i kinda want a full resource where someone built the whole thing like i want todo, and describe the process in it, just to understand how much work i'm expecting to do before get my hands dirty to the implementation.

I aim more to build a really quick and simple engine honestly, nothing big, but at least that can handle the QuickJS benchmarks, so nothing so ambitious, just a way to learn more about javascript in a more in depth way.

so if you did it and you found some resources that you find particularly useful if you can post it in the comments it would be awesome!

thanks hn!


  👤 NickRandom Accepted Answer ✓
I would (if I was an insane masochist) start with reading the source code of JS from the first version onwards to get a sense of things.

https://www.w3schools.com/js/js_history.asp and

https://www.w3schools.com/Js/js_versions.asp


👤 dachrillz
Andreas Kling, the original author of the serenity os, has a series on youtube where he builds a javascript engine for his web browser.

That could be a good start for you if you want to see a competent programmer build an engine from scratch

Good luck!


👤 PaulHoule
There is a lot of literature on compilers and interpreters, see

https://craftinginterpreters.com/introduction.html