A new JavaCC grammar for EcmaScript

01 Sep 2006

It looks like the Dojo folks (actually, some AOL people) have put together a new JavaCC grammar for EcmaScript; there's a blog entry, the grammar itself, and I generated a nicely linked HTML view of the grammar thanks to JavaCC's pretty-printer, JJDoc. It's a pretty hefty grammar with a bunch of productions, and it looks like they did a nice job using the JJTree node descriptors to suppress unnecessary nodes - see CaseClause for an example of that.

Since I've been working on a JavaCC book I've been trying to track new grammars; seems like they're starting to pop up a bit more often nowadays. It'd be nice to have a JavaCC grammar for all the languages on the Fistful of Languages blog; someday maybe!

Incidentally, I wonder how hard it'd be to extend JJDoc to display the token definitions somehow? Seems like that'd be handy information to have in that HTML page. And sometime I'd like to add a new JJDoc option to let it use a stylesheet; that would be a pretty simple change but could allow the HTML to be much more concise and probably look nicer too.