A simple tool showing how a java source file is parsed, using the Java grammar from Openjdk javac compiler project with ANTLR-based Java grammar . Here's a screenshot:
You can grab the source or runnable jar from the attachments on this page.
The tool is based on a very simple idea: embedding code in the grammar to create a node for every rule invocation. The result is a parse tree. As the parser parses a Java file, the tree is built as each rule is invoked.
...