help-bison
[Top][All Lists]
Advanced

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

How can I fix it?


From: Davide Rizzo
Subject: How can I fix it?
Date: Sun, 9 Feb 2003 20:25:19 +0100

I defined two similar rules which look like

date_interval:  FROM    { /* exec some code - mid-rule action */ }
                date    { /* exec some code - mid-rule action */ }
                UPTO
                date    { /* exec some code - normal action */ }
        ;

time_interval:  FROM    { /* exec some code - mid-rule action */ }
                time    { /* exec some code - mid-rule action */ }
                UPTO
                time    { /* exec some code - normal action */ }
        ;

where date and time specifies date and time formats, such as "march 3 2004",
"3/3/04" or "13:45".
I can't get the second rule to be matched, I mean, when the parser try to
build up the tree, I get a "parse error" right after having reduced to the
first "time" pattern and when the next token is UPTO. What is strange is
that the mid-rule actions don't work at all, while the date_interval ones
work fine, and that, observing the output produced by Bison, I can't see any
@n grouping, which should be made up of non-terminal and terminal together
with mid-rule action (which becomes a king of pseudo-terminal).
I guess the problem is that, having only on looakahed token, Bison cannot
understand which code to execute having in stack only FROM. Is that true?
How can I fix it up? Maybe using trailing context in Flex to return two
kinds of FROM token, depending on what follows?
I would appreciate any help
sorry for my english, regards
Davide
 
ps: I lately focused my attention on "Mysterious Reduce/Reduce Conflicts" on Bison 1.35 documentation: may the problem be a kind of misundestanding which leads to a common state definition for both date_interval and time_interval?

reply at address@hidden if you can

reply via email to

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