help-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GLR ambiguity


From: Hans Aberg
Subject: Re: GLR ambiguity
Date: Sat, 16 Jun 2007 23:10:12 +0200

On 16 Jun 2007, at 08:15, Paul Hilfinger wrote:


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.

We did not get to know how much of actual language process that was intended - perhaps the intent was only to filter out quotations?!

But it would sure be interesting if somebody took up the quest of doing a natural language grammar. There is, in fact, a Flex/Bison grammar for the constructed language lojban, which is made not not be ambiguous:
  http://www.lojban.org/tiki/tiki-index.php?page=Home+Page&bl
It might give inputs on how to do it for natural languages.

  Hans Aberg






reply via email to

[Prev in Thread] Current Thread [Next in Thread]