My Java 5 Antlr grammar 6
After years of toying with Antlr but never actually doing anything useful with it; and after months of merely skimming articles on new Java 5 language features I thought I’d deepen my understanding of both and update the Antlr Java 1.4 grammar to recognize the new language features.
Suprisingly it only took about a week to polish off, and most of that was spent just cleaning up the grammar and deciding between different ways to structure the output AST (rather than strugling with Antlr tool itself).
For anyone interested, my grammar can be found on my site and it’s also hosted at antlr.org
As for how well tested it is: I’ve used it to successfully recognise the entire Java 5 source base, jdigraph’s source base (an early adopter of generics) and some custom tests I developed. I found the accompanying AST recogniser (as opposed to the token stream recogniser) is a good tool for confirming your tree is structured as you expected it to be. I also visually inspected the AST to ensure its structure was what I expected. An alternative to visual inspection would be great to automatically ensure the grammar stays correct over a lifetime of modifications. I’d love to hear from anyone who’s worked on such a tool. A testing framework that used XQuery or XPath querying/assertions on DOM-adapted AST (similar to PMD’s AST interface) would be my first approach. Comments or experience anyone?
More comments on Antlr and Java 5’s new language features later.
I'm a Grammar God
According to BaalObsidian , I’m a grammar God!
Here’s their HTML badge to prove it:

You are a GRAMMAR GOD!
If your mission in life is not already to
preserve the English tongue, it should be.
Congratulations and thank you!
How grammatically sound are you?
brought to you by Quizilla
I think they mean the American English tongue, though.