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: Adam Smalin
Subject: Re: Tell a rule to shift instead of reduce?
Date: Sun, 22 Dec 2013 12:38:37 -0500

That's one way to solve my literal problem but I would really like to make
',' a higher precedence than '=' on that one rule (so it would shift
instead of reducing 100% of the time).

Both sides should be rvals. What if someone wanted to do something like

get_state().member[index].value, new_state, error_id = func(current_state,
config)

Is there no way to overload the way the rule resolves the shift/reduce? I
tried prec and dprec several times one email is
http://lists.gnu.org/archive/html/help-bison/2013-12/msg00022.html
I tried using prec directly before and after the comma but that didn't
override the reduce into a shift.


On Sun, Dec 22, 2013 at 11:43 AM, Akim Demaille <address@hidden> wrote:

>
> Le 17 déc. 2013 à 09:25, Adam Smalin <address@hidden> a écrit :
>
> > I still need help with this. I rewrote it maybe this will be more clear?
> >
> > I want to allow this
> >
> > var = var
> > var, var = var
> > var = var, var
>
> Maybe I am missing something, by how about clearly stating
> that you can have several lvalues and rvalues?  The following
> grammar has no conflict, and requires no precedence/associativity.
>
> %%
> body:
>   lvals '=' rvals
> ;
>
> lvals:
>   lval
> | lvals ',' lval
> ;
>
> rvals:
>   rval
> | rvals ',' rval
> ;
>
> rval: "var"
> lval: "var"
>
>


reply via email to

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