Back

Ambiguous grammar

Parse4j can parse using ambiguous grammar and output alternative for ambiguities.

In some case, generally bugged grammar, the number of alternative is so huge that an "out of memory java heap space" occurs while parsing. This occurs after à long execution time. To avoid this the number of alternative is limited. The maximum number of alternative for ambiguity is fixed to 10 by default, it can be set to other value using Parser#setMaxNumberOfAlternative

Accepting ambiguity or not can be set when call parser.
If ambiguity is not accepted and ambiguity is found then exception is throw and ambiguous parse nodes are logged.

Avoid ambiguity can be done in two ways



© 2008-2009, parser4j