parse function returns a
ParseForest is an efficient shared representation of multiple
ParseTree objects. For some grammars, therefore, you must be careful dealing with
as they may contains exponentially many possible parses.
single, all, count, and __iter__¶
These are the basic methods for extracting parse trees from the forest.
ParseForest.count() returns a count of all the trees.
ParseForest.all() returns a list of all the trees in the forest. It can be quite large.
penalty settings described in Greedy Symbols allows you
to eliminate alternative parses. In the extreme case of marking every nonterminal with
plus symbol with
greedy, then you will never have an ambiguous parse.