I recently came across Matthew Hind's TeaClipse project which he recently announced on his blog. TeaClipse is an open source compiler for the Tea programming language. You can read Matthew's thesis on the project here. Note that if you want to use the grammar you'll need to make a couple of small modifications to SimpleNode that he describes in the thesis - and if you don't make them, the compiler will tell you about them.
I ran the grammar through JJDoc and here is the HTML'ized grammer. It looks good and is pretty straightforward. One minor suggestion I have is that the
OPTIMIZE_TOKEN_MANAGER option is no longer available in JavaCC 4.0, so it can be removed from the grammar. You may want to use
CACHE_TOKENS instead, especially in this case since the Tea editor is reading from a file rather than processing new characters as they're typed.
Another small suggestion - JavaCC now has a facility for inlining assignment code more effectively. For example, rather than doing this:
You can now do this:
That is, you can just make the assignment inline rather than first assigning to a temporary variable and then making another assignment in a syntactic action. This saves some space, is arguably easier to read, and is more efficient to boot. The method_declaration nonterminal in tea.jjt is one place where this might be useful.
I'm reading through the rest of Matthew's thesis now and learning a bit about quadruples. Good stuff! And of course, as the author of a JavaCC book I'm always happy to see new grammars surface!