I am trying to build a compiler (from scratch). The problem is I have a mature SLR grammar that works a llittle occasionally. It is not clear what makes it work or not work. If I trim the grammar for debugging purposes., the part that works quits working. That is truely wierd.
prog : program
;
progarm : BLOCK
;
BLOCK : BEGIN_SYM declist semililist stamtlist END_SYM
;
declist : declare
| declist semilist declare
;
declare : storage dectype id_list
| dectype id_list
storage : OWN
| EXTERN
;
dectype : INTEGER
| REAL
| string
| INTEGER ARRAY
| REAL ARRAY
| STRING ARRAY
;
id_list : id_list COMMA ID
| ID
infact I get the following
BEGIN
OWN
INTGER
i COMMA
j COMMA
k COMMA
l COMMA
m COMMA
n
1 1 syntax error SEMICOLON
All I can figure is that BISON opmizies the internal state and clips something
If if remove something to simplify the grammar . It quits doing this even.
If I look at the try.output it looks lke the state values are correct and the tokken selection should work. But it doesnt.
I have an SLR table generaror and it doesn not optimize and it does not make hidden changes.
josephus