问题
Given Bison Specification: %right TOK_ADD TOK_MUL
I was wondering what would be the precedence order of TOK_ADD and TOK_MUL.
Also in case i had Bison specification
%left TOKMUL TOKADD
%left TOKDIV
%left TOKSUB
I was wondering what would the precedence order of TOKMUL TOKADD TOKDIV and TOKSUB be
回答1:
bison/yacc precedence order is lowest to highest -- the tokens on the first line listed have the lowest precedence while those on the last have the highest. Multiple tokens on the same line (TOKMUL
and TOKADD
in your case) have the same precedence
来源:https://stackoverflow.com/questions/26458080/bison-specification-and-precedence-order