I've got another issue that I can't seem to get pyggy to deal with. I
distilled my problem down to this example. Is there anyway to make this
unambiguous? Here's my lexer and parser:
foo.pyl:
INITIAL:
",": return "COMMA"
"[[:digit:]]+": return "CONSTANT"
"[[:blank:]]": return
"\n": return
foo.pyg:
expression -> COMMA list COMMA;
list ->
CONSTANT
| CONSTANT COMMA CONSTANT
;
Conceptually, this should be able to work. If it sees ", 1 ," it should
use the first pattern in "list", and if it sees ", 1 , 2 ," it should
take the second. It looks its getting confused walking down both
posibilites. I was under the impression though that GLR parsers can
handle this situation correctly. Shouldn't it be something like this?
read "COMMA" or error
read "CONSTANT" or error
read "COMMA" or error
read next token. if "$eof$", match with first list branch. if
"CONSTANT" drop first branch and continue checking against second
branch.
Or do I misunderstand GLR parsers? Also, I did try the "nonassoc SHORT
LONG" for matching if-then-else's, but that didn't appear to work. Any
help would be greatly appreciated.
-e