[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Change to shift instead of reduce
From: |
Adam Smalin |
Subject: |
Change to shift instead of reduce |
Date: |
Sat, 1 Jun 2013 14:49:00 -0400 |
I have another thread but here is a simple version of my problem
My text input is
a.b c.d
What I would like is
varname varname
My grammar is
%glr-parser
//...
mainLoop:
mainElement %dprec 5
| mainLoop mainElement %dprec 4
mainElement:
'$' VarName %dprec 6 { printf("varname\n"); }
| VAR %dprec 3 { printf("var\n"); }
| Token %dprec 2 { printf("token\n"); }
Token: '.' %dprec 1
VarName: VAR %dprec 7
| VarName '.' VAR %dprec 8
The conflict file shows
6 mainElement: '$' VarName . [$end, VAR, '.', '$', '\n', ';']
11 VarName: VarName . '.' VAR
'.' shift, and go to state 18
'.' [reduce using rule 6 (mainElement)]
$default reduce using rule 6 (mainElement)
Now I see $default reduce. I'd like it to shift. I threw in a bunch of
precedence hoping something would trigger a shift instead of a reduce but
no. What can I do?
- Change to shift instead of reduce,
Adam Smalin <=
Re: Change to shift instead of reduce, Ron Burk, 2013/06/03