|ITE bison grammar problem firstname.lastname@example.org (pmatos) (2005-06-04)|
|Re: ITE bison grammar problem email@example.com (pmatos) (2005-06-04)|
|Re: ITE bison grammar problem firstname.lastname@example.org (Carl Barron) (2005-06-05)|
|Re: ITE bison grammar problem bluemalov_NOSPAM_@hotmail.com (Andrew Wilson) (2005-06-05)|
|Date:||4 Jun 2005 15:12:02 -0400|
|Posted-Date:||04 Jun 2005 15:12:02 EDT|
I have right now a big grammar for a language I conveived to simplify
another problem but that's not important right now. The fact is that
I'm left with a reduce/reduce conflict which is rather serious and I
can't solve it. I've managed to create a simple grammars that shows
%left '&' '+'
F: "ite" '(' F ',' F ',' F ')'
| E '&' E
M: E "==" E;
E: "ite" '(' E ',' E ',' E ')'
| E '+' E
(F is formula which represents a boolean value and E is an expression
which represents a numerical value, id is an identifier that can
represent a numerical value or a boolean value but that depends on its
definition, right now, it's a sequecene of chars)
The problem is quite simple to understand... and it happens in the
middle of "ite" (if-then-else), in the expression "ite" the value of
the "ite" is another expression and in the formula "ite" the value of
the "ite" is a boolean value, and because of that if the
formula/expression is a single identifier, which can both be, since in
BOTH there comes a COMMA right away... there's no way to know if we
reduce a formula or expression.
Any ideas on how to solve this issue?
[My advice would be to treat them the same syntactically and sort them out
in the semantics. This lets you produce better error messages like "boolean
variable XYZ used for arithmetic" rather than "syntax error". -John]
Return to the
Search the comp.compilers archives again.