Next: , Previous: , Up: Terms   [Contents][Index]


4.11 Ambiguity

Marpa allows ambiguous grammars. Traditionally we say that a parse is ambiguous if, for a given grammar and a given input, more than one derivation tree is possible. However, Marpa allows ambiguous input tokens, which the traditional definition does not take into account. If Marpa used the traditional definition, all grammars would be ambiguous except those grammars which allowed only the null parse.

[ TODO: Rewrite two reasons to differ from traditional definition – ambiguous tokens and pruned null forests. Def is that cardinality of forest > 1. ]

It is easiest if the Marpa definition and the traditional definition were extensionally equivalent — that is, if Marpa’s set of ambiguous grammars was exactly the same as the set of traditionally ambiguous grammars. This can be accomplished by using a slightly altered definition. In the Marpa context, a grammar is ambiguous if and only if, for some UNAMBIGUOUS stream of input tokens, that grammar produces more than one parse tree.