Bison specification and order of precedence

Given Bison BOM:% right TOK_ADD TOK_MUL

I was wondering what the order of precedence of TOK_ADD and TOK_MUL would be.

Also in case I had a Bison spec

%left TOKMUL TOKADD
%left TOKDIV
%left TOKSUB

      

I was wondering what would be the order of precedence of TOKMUL TOKADD TOKDIV and TOKSUB be

+3


source to share


1 answer


bison / yacc priority order is lowest to highest — the tokens on the first line are listed with the lowest priority, and the lowest are highest. Multiple tokens on the same line ( TOKMUL

and TOKADD

in your case) have the same priority



+1


source







All Articles