added C like precedence for operators

This commit is contained in:
Sven Vogel 2024-05-14 19:20:58 +02:00
parent 3ea179b4a9
commit 32b964444a
1 changed files with 10 additions and 3 deletions

View File

@ -104,12 +104,19 @@
%token FunExtsupport
/* Operator associativity */
/* Operators at lower line number have lower precedence */
/* Operators in same line have same precedence */
%right '='
%left OpOr
%left OpXor
%left OpAnd
%left OpBitor
%left OpBitxor
%left OpBitand
%left OpEquals '<' '>'
%left '+' '-'
%left '*' '/'
%left OpEquals OpNot '<' '>'
%left OpAnd OpOr OpXor
%left OpBitand OpBitor OpBitxor OpBitnot
%left OpNot OpBitnot
%%
program: program programbody {AST_push_node(root, $2);}