Parser Generation
The action language parser is automatically generated using JavaCC tool set. JavaCC is widely used tool for parser generation and is distributed under Berkeley Software Distribution (BSD) license. It supports LL(k) grammars and generates parsers implementing recursive descent algorithm.

The action language grammar as defined in Parser.jjt is an LL(2) grammar. The input file also contains definition of lexical elements of the language and annotate non-terminals with tags to ease the navigation in the abstract syntax tree which is important in the semantic interpretation of some of the language constructs, namely for type checking.
The parser is generated from Parser.jjt file in several steps. The process is automated using an Ant build file. First, jjtree tool is applied to the Parser.jjt to extract the lexical symbols and grammar. The grammar is annotated with instructions to build the user customized syntax tree that can be later used by the user to gather additional information needed for semantic analysis. The output of the first step is saved as Parser.jj file. Then javacc tool applied to the Parser.jj file. The javacc tool generates set of Java source files (*.java) that implement the parser and offer interface to access the syntax tree while (or after) the parsing.