Re: Tell a rule to shift instead of reduce?

2013-12-22 Thread Adam Smalin
> Please, post a self contained and minimal example. Ok. I didn't test it by parsing actual code. I only looked at the conflict %left ',' %right '=' %left '.' %% program: newline_many global_loop newline_many global_loop: global_expr | global_loop global_expr global_expr: VAR

Re: Tell a rule to shift instead of reduce?

2013-12-22 Thread Akim Demaille
Le 22 déc. 2013 à 20:35, Akim Demaille a écrit : > > Le 22 déc. 2013 à 18:40, Adam Smalin a écrit : > >> I forgot to CC this to the group a few days ago. >> >>> The token precedences apply to the tokens immediately before and after the >>> parsing ‘.’ (as in the .output file) in the shift/r

Re: Tell a rule to shift instead of reduce?

2013-12-22 Thread Akim Demaille
Le 22 déc. 2013 à 18:40, Adam Smalin a écrit : > I forgot to CC this to the group a few days ago. > > >The token precedences apply to the tokens immediately before and after the > >parsing ‘.’ (as in the .output file) in the shift/reduce conflicting rules. > >The grammar must be written so th

Re: Tell a rule to shift instead of reduce?

2013-12-22 Thread Akim Demaille
Le 22 déc. 2013 à 18:38, Adam Smalin a écrit : > 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

Re: How to make C++-generated parser call yylex in some polymorphic way?

2013-12-22 Thread John Horigan
I have used the technique described here: http://panthema.net/2007/flex-bison-cpp-example/ It works with vanilla Bison from 2.3 (maybe earlier) up through 3.0. -- john On Sun, Dec 22, 2013 at 9:04 AM, Oleksii Taran wrote: > Hi all > > Is there a way to not call global C-style `yylex` function

Re: Tell a rule to shift instead of reduce?

2013-12-22 Thread Adam Smalin
I forgot to CC this to the group a few days ago. >The token precedences apply to the tokens immediately before and after the parsing ‘.’ (as in the .output file) in the shift/reduce conflicting rules. The grammar must be written so that the tokens appear in such a position. | rval '=' rval %prec

Re: Tell a rule to shift instead of reduce?

2013-12-22 Thread Adam Smalin
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

How to make C++-generated parser call yylex in some polymorphic way?

2013-12-22 Thread Oleksii Taran
Hi all Is there a way to not call global C-style `yylex` function in generated C++ parser? Now I just patch `lalr1.cc` to add pure virtual method `yylex` in parser skeleton and override it in subclass. The downside is that I can't use vanilla bison, and I must reapply patch on every update. Do

Re: Tell a rule to shift instead of reduce?

2013-12-22 Thread Akim Demaille
Le 17 déc. 2013 à 09:25, Adam Smalin 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 r