Re:Plan to throw one away
by curiousGambler on Monday December 14, 2015 @08:19PM
(#10735332)
This makes me want to write a JS interpreter... Sweet read!
[ Parent
| on HN ]
A 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.
Here you have one written in OMeta: http://www.tinlizzie.org/ometa-js/#JavaScript_Compiler