Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Image Removed

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:

Image Added

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.

...