[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: GLR ambiguity
From: |
Alessandro Di Marco |
Subject: |
Re: GLR ambiguity |
Date: |
Thu, 14 Jun 2007 13:54:42 +0200 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.1.50 (gnu/linux) |
OK, I forgot the attachment. Moreover, the below ambiguity arises with the
string: /"hello." people./ (without '/').
sorry.
Alessandro
demo.tgz
Description: Binary data
Alessandro Di Marco <address@hidden> writes:
Hi all.
I was trying to create a GLR grammar for natural languages when I stuck on
the
following s/r ambiguity.
Ambiguity detected.
Option 1,
text -> <Rule 2, tokens 1 .. 6>
text -> <Rule 2, tokens 1 .. 3>
text <empty>
sentence -> <Rule 4, tokens 1 .. 3>
DOUBLEQ <tokens 1 .. 1>
WORD <tokens 2 .. 2>
EOL <tokens 3 .. 3>
sentence -> <Rule 4, tokens 4 .. 6>
DOUBLEQ <tokens 4 .. 4>
WORD <tokens 5 .. 5>
EOL <tokens 6 .. 6>
Option 2,
text -> <Rule 2, tokens 1 .. 6>
text -> <Rule 2, tokens 1 .. 4>
text <empty>
sentence -> <Rule 5, tokens 1 .. 4>
DOUBLEQ <tokens 1 .. 1>
WORD <tokens 2 .. 2>
EOL <tokens 3 .. 3>
DOUBLEQ <tokens 4 .. 4>
sentence -> <Rule 3, tokens 5 .. 6>
WORD <tokens 5 .. 5>
EOL <tokens 6 .. 6>
ERROR!
Cleanup: popping token $end ()
Cleanup: popping unresolved nterm text ()
Cleanup: popping unresolved nterm sentence ()
Cleanup: popping token EOL ()
Cleanup: popping token WORD ()
Cleanup: popping token DOUBLEQ ()
Cleanup: popping unresolved nterm text ()
Cleanup: popping unresolved nterm sentence ()
Cleanup: popping token EOL ()
Cleanup: popping token WORD ()
Cleanup: popping token DOUBLEQ ()
Cleanup: popping nterm text ()
Cleanup: popping token $end ()
It seems that both the options above are valid, so they need
disambiguation. I've tried '%dprec' (as also suggested in bison manual), but
without any success.
For your convenience I have stripped down the grammar to the below few lines,
which produce the above result.
text:
/* empty */
| text sentence
;
sentence:
WORD EOL
| DOUBLEQ WORD EOL
| DOUBLEQ WORD EOL DOUBLEQ
;
where:
[[:alnum:]]+ return WORD;
\" return DOUBLEQ;
\. return EOL;
I've also attached a q&d demo of the problem; simply untar, make and execute
'./demo'. Tested both on bison 2.2 and 2.3... won't work! :-)
Thanks in advance.
Best,
Alessandro
--
Catch 22 - Joseph Heller
- GLR ambiguity, Alessandro Di Marco, 2007/06/14
- Re: GLR ambiguity,
Alessandro Di Marco <=
Re: GLR ambiguity, Hans Aberg, 2007/06/14