ECMAScript 5 Parser

2010-08-16

Demonstrating an ECMAScript 5 parser generated by PanPG v0.0.6.

The previous v5 codegen (not to be confused with the v0.0.5 release, which used the v6 codegen; the codegen and PanPG version numbers are independent) was faster by about 5-10x on this grammar. The reason for the slowdown is that the v6 codegen is currently completely unoptimized, unlike the v5 codegen which had some optimizations enabled. The new codegen will eventually be much faster than the old. See the project roadmap for the details. In short, v0.0.6 is an API release, and following will be performance releases.

You can look at the PEG input from which the parser is generated.

Generating the ES5 parser from the PEG input takes around ten seconds of CPU time; here we read it from the server instead of generating it on each page load. The arithmetic demo demonstrates generating a parser at runtime from a (much smaller) grammar.