Le 4 juin 2013 à 20:47, Adam Smalin <acidzombi...@gmail.com> a écrit :
> I put the below in my main project just to test it out so I don't have a > self contained source but the below should explain everything. Be sure to read the whole section about precedence. http://www.gnu.org/software/bison/manual/html_node/Precedence.html > From my understanding since '.' is more important then DOLLAR it will win. The wording is "'.' has higher precedence than '$'". > Precedence is chosen the order nonassoc/left/right where the first seen is > least important. The conflict `VarName . '.'` VS `'$' VarName .`. So giving > the end of rule prec token it will see that its 'DOLLAR' which makes it not > give the ambiguity error. It sees '.' is a higher precedence then DOLLAR so > it will shift rather then reduce. > > I think I said the above right I think you did, yes. > %nonassoc DOLLAR > %left '.' > > %% > program: mEOS main > main: | mainLoop mEOS > mainLoop: > mainElement > | mainLoop mainElement > mainElement: > '$' VarName %prec DOLLAR { printf("varname\n"); } > | mainElement2 > mainElement2: > VAR { printf("var\n"); } > | Token { printf("token\n"); } > > Token: '.' > VarName: VAR > | VarName '.' VAR > > EOS: '\n' | ';' > mEOS: | mEOS EOS > > %% > > > On Tue, Jun 4, 2013 at 5:46 AM, Akim Demaille <a...@lrde.epita.fr> wrote: > >> >> Le 4 juin 2013 à 11:04, Adam Smalin <acidzombi...@gmail.com> a écrit : >> >>> Nevermind I figured that out >> >> Great! >> >> Please, do try to make small self-contained examples when you >> can. >> >> > _______________________________________________ > help-bison@gnu.org https://lists.gnu.org/mailman/listinfo/help-bison _______________________________________________ help-bison@gnu.org https://lists.gnu.org/mailman/listinfo/help-bison