Versions Compared

Key

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

...

To get the most out of ANTLR, you should get The Definitive ANTLR Reference. It is required reading to become an advanced user. For example, Part III provides the only thorough explanation available anywhere of ANTLR's LL(star) (*) parsing strategy.

  1. First you have to get the software: Download ANTLR v3 and install it (see How do I install this damn thing?) or get the ANTLRWorks grammar development environment, which includes ANTLR. You can just click on the ANTLRWorks jar to get started.
  2. Try a cut-and-paste example such as Expression evaluator either by pasting into ANTLRWorks and running the interpreter or debugger (see ANTLRWorks tutorial) or using an editor and manually invoking ANTLR from the command line (see How do I use ANTLR v3 from the command line?).
  3. Try modifying an existing grammar; change actions and rule elements to see what happens.

That should give you a taste of how to run ANTLR on a simple grammar and some clue about how to build a recognizer and translator. From here, you should start with an existing grammar that is similar to your intended application and start modifying it. There are a number of tutorials you can look at that explain some of the basics of building translators and provide some grammars to tweak:

When you run into questions, first examine the output (and source of ANTLR if you want) to see if you can answer your own question. Then you should check the following:

...