3 ms·
A parser generator? Why oh why? It sounds so 80s. JavaScript is strong enough to express parser combinators, e.g. see Chris Double's implementation (also based
by cousin_it 17y ago
A parser generator? Why oh why? It sounds so 80s. JavaScript is strong enough to express parser combinators, e.g. see Chris Double's implementation (also based on the PEG formalism):
http://www.bluishcoder.co.nz/2007/10/javascript-parser-combinators.html http://www.bluishcoder.co.nz/2007/10/javascript-parser-combi...
I did the same thing in ActionScript. It's easy and fun.
- dmajda 17y agoI believe that the classical generated parser has generally better performance potential - there is less function calling, less string passing (but this may be avoided easily in combinators too) and more opportunity for optimalization if you have the whole grammar AST in hand.
- doublec 17y agoIt was pointed out to me that my git repository hosting this code was down. I've now moved it to github if anyone was looking for it: http://github.com/doublec/jsparse http://github.com/doublec/jsparse