Parsing using ambiguous grammar

A deliberately ambiguous grammar:

usually expression grammar are writed to not be ambiguous, here it is only to show how parse4j deal with ambiguous grammar. see how it is possible to disambiguate.

The ambiguous grammar:

Start : Expression

Expression : 'a'
           | Expression '+' Expression
           |
Expression '*' Expression

Parsing of "a+a*a" result

Below the parsing tree of input "a+a*a". You can see there is two possibilities:




© 2008-2009, parser4j