help-bison
[Top][All Lists]
Advanced

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

Re: Tell a rule to shift instead of reduce?


From: Akim Demaille
Subject: Re: Tell a rule to shift instead of reduce?
Date: Tue, 24 Dec 2013 14:57:47 +0100

Le 23 déc. 2013 à 14:38, Adam Smalin <address@hidden> a écrit :

> Oh crap! It's looking at the token ',' and not the other rules (rule 12).
> FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
> I want to rule 12 to trump rule 15. Rule 15 precedence should definitely
> stay the same. F!

I don’t understand what you mean.  You can’t tell Bison
that a rule should win over another rule (unless you
use glr and %dprec).  You can only compare tokens and
rules to address S/R conflicts.

Be sure to perfectly understand this section:
http://www.gnu.org/software/bison/manual/bison.html#Precedence

> So it's impossible for me to ask bison to shift during rule 12 when
> possible?

Actually « shift » is something that tokens do, rules « reduce ».

> This reminds me of when I first learned regular expressions and
> about ‘greedy' patterns.

Well, not really related.

> F. Alright I guess I'll do lvals as you suggested.
> Darn I was hoping it is possible for me to override rules :(

I believe that in the end, you’ll find it easier a grammar
to live with.




reply via email to

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