[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Updating UnderC C/C interpreter and reduce/reduce conflicts
From: |
Domingo Alvarez Duarte |
Subject: |
Re: Updating UnderC C/C interpreter and reduce/reduce conflicts |
Date: |
Tue, 30 Mar 2010 01:47:08 +0200 |
I did looked at both but till now I couldn't figure out how to solve then
and that is the reason I'm posting it to see if some people with higher
knowledge can give me a clue !
Also this part of the grammar is responsible for 96 reduce reduce conflicts:
/* bitwise */
| BIN_NOT _expr { $$=unary_op(BIN_NOT,$2); }
| _expr LSHIFT _expr { $$=bin_op(LSHIFT,$1,$3); }
| _expr RSHIFT _expr { $$=bin_op(RSHIFT,$1,$3); }
| _expr ADDR _expr %prec BIN_AND { $$=bin_op(BIN_AND,$1,$3); }
| _expr BIN_XOR _expr { $$=bin_op(BIN_XOR,$1,$3); }
| _expr ADDR _expr %prec BIN_OR { $$=bin_op(BIN_OR,$1,$3); } //<<<< here
94 reduce reduce conflicts
It seems wrong for me but it's working, by wrong I mean "_expr ADDR _expr
%prec BIN_AND" and "_expr ADDR _expr %prec BIN_OR" aparently using the same
symbol "ADDR" -> '&' to manage bitwise '&' and '|'.
Some other parts have lot's of shift/reduce conflicts:
State 0 conflicts: 74 shift/reduce
State 199 conflicts: 74 shift/reduce
State 344 conflicts: 74 shift/reduce
State 428 conflicts: 39 shift/reduce
State 527 conflicts: 74 shift/reduce
State 529 conflicts: 39 shift/reduce
On some of those rules basically the whole grammar appear twice.
I'm reading in several places that some grammars like C/C++ aren't free of
conflicts, but so much is it indicating a poor grammar design ?
But the incredible is that it works for a big part of C/C++.
Thnaks for your time and attention !
- Re: Updating UnderC C/C interpreter and reduce/reduce conflicts,
Domingo Alvarez Duarte <=