3 ms·
Anyone have a recommendation for a good place to begin, if I was interested in writing a toy javascript interpreter?
by dubroff 11y ago
Anyone have a recommendation for a good place to begin, if I was interested in writing a toy javascript interpreter?
- d0m 11y agoFriends of mine used "Create Your Own Programming Language" to get started learning about interpreters: http://createyourproglang.com http://createyourproglang.com I personally learned with SICP (But reading this book isn't just about interpreter, it will make you a better programmer and blow your mind in so many different ways. I wouldn't say it's for experts only, but this isn't the kind of book that beginners would get excited about. However, if someone is serious about improving as a developer, I can't think of a better book): http://www.amazon.com/Structure-Interpretation-Computer-Programs-Engineering/dp/0262510871/ http://www.amazon.com/Structure-Interpretation-Computer-Prog... Finally, (How to Write a (Lisp) Interpreter (in Python)) by norvig is a great read if you're getting started with interpreter: http://norvig.com/lispy.html http://norvig.com/lispy.html * The reason the two last links are lisp related is because writing interpreter in Lisp is really straightforward (Since the code is the AST). Similarly, if you wanted to learn about memory management, a language like assembler or C might be more suited than say Python.
- pmontra 11y agoYou can check this code https://github.com/espruino/Espruino/blob/master/README.md https://github.com/espruino/Espruino/blob/master/README.md I quote "Espruino is a JavaScript interpreter for microcontrollers. It is designed to fit into devices with as little as 128kB Flash and 8kB RAM." It could be a good example of a small js interpreter. I remember the author said to be 95% compatible with real js. That was a couple of years ago.
- WalterBright 11y agoYou can start with https://github.com/DigitalMars/DMDScript https://github.com/DigitalMars/DMDScript which is an open source (Boost licensed) JavaScript engine written in D.