4 ms·
This makes me want to write a JS interpreter... Sweet read!
by curiousGambler 11y ago
This makes me want to write a JS interpreter... Sweet read!
- PeCaN 11y agoA simple ES3 interpreter is pretty easy, particularly if you just go for 'the good parts' (plus basic global objects). I can highly recommend mpc[1] if you do, it's a really amazing library for parser combinators in C. I was never much of a fan of yacc/lex (perhaps out of my ignorance of BNF). With yacc/lex I always felt like I had to have my grammar all planned out (which if you implement JS I suppose isn't a problem) before I could start developing and it was very hard to work incrementally. mpc is very flexible and since it's just a C library I find it a lot easier to iterate with. 1: https://github.com/orangeduck/mpc https://github.com/orangeduck/mpc
- scotty79 11y agoHere you have one written in OMeta: http://www.tinlizzie.org/ometa-js/#JavaScript_Compiler http://www.tinlizzie.org/ometa-js/#JavaScript_Compiler