This is the grammar for Java SE 7. Written as per to the LBNF spec. You can use BNFC to generate boilerplate code to traverse/modify the syntax tree in any of the languages supported by it.