> On 14 Jun 2007, at 12:48, Alessandro Di Marco wrote: > I was trying to create a GLR grammar for natural languages > ...when I stuck on the > following s/r ambiguity.
> text: > /* empty */ > | text sentence > ; > > sentence: > WORD EOL > | DOUBLEQ WORD EOL > | DOUBLEQ WORD EOL DOUBLEQ > ; > GLR does not resolve grammar conflicts statically. Bison will continue to report conflicts, and these reports really don't tell you much. Since natural languages ARE ambiguous, what you must use GLR for is to gather the possible interpretations. That is the purpose of %merge, which allows you, on encountering two different parses of the same phrase, to collect the interpretations (syntax trees, or whatever semantic values you are using) and return this collection (represented however you choose) as the value of the ambiguous construct. %merge also allows you to reject some interpretations on context-sensitive grounds. When I say "allows you" I don't mean that it provides specific facilities to do any of this, but rather that it gives a parser structure that allows YOU to write the necessary actions. Paul Hilfinger _______________________________________________ [email protected] http://lists.gnu.org/mailman/listinfo/help-bison
