Latest Features


Changes took place mostly at the grammar generation phase. Existing DAJ projects should not be affected in anyway. DAJ .cd files can now accept local lookahead declarations to help disambiguate between alternatives and/or optional parts. An example:

          TypeDeclaration   :
                lookahead(@ ( "abstract" | "final" | "public" )* "class" @)
                SemiColonTD .

The above will force the parser to choose a ClassDeclaration in the case were the next 2 tokens in the stream match the definition declares inside (@ @). Local lookahead can be defined for alteration class definitions or inside optional parts of a concrete class.

You are not limited to stings inside local lookahead definitions. You can also specify a whole parser rule by prepending the string parse followed by the name of the rule in your class dictionary followed by (). For example

          Expression    :
          lookahead(@ parsePrimaryExpression() parseAssignmentOperator()@)
          ConditionalExpression .

where PrimaryExpression and AssignementOperator are rules inside the same class dictionary file. Local lookahead definitions are mapped to syntactic predicates in antlr.

Known Limitations

If your class dictionary contains a "." as part of your defining language's syntax then DAJ generates an ambiguous grammar and can cause unexpected behavior.