fixed shift reduce conflicts by removing epsilon functions

This commit is contained in:
Sven Vogel 2024-05-06 16:41:23 +02:00
parent f8c888216a
commit 02628a56d6
1 changed files with 23 additions and 19 deletions

View File

@ -73,57 +73,61 @@ expr: ValFloat
| operation;
exprlist: expr ',' exprlist
| expr
| ;
| expr;
paramlist: paramlist '(' exprlist ')'
| ;
paramlist: '(' exprlist ')' paramlist
| '(' exprlist ')';
funcall: Ident paramlist { DEBUG("Function call"); };
assign: Ident '=' expr { DEBUG("Assignment"); };
statementlist: statementlist statement
| ;
statementlist: statement statementlist
| statement;
statement: assign
| decl
| definition
| branch;
| branch
| funcall;
branchif: KeyIf expr '{' statementlist '}' { DEBUG("if"); };
branchelse: KeyElse '{' statementlist '}' { DEBUG("if-else"); };
branchelseif: KeyElse KeyIf expr '{' statementlist '}' { DEBUG("else-if"); };
branchelseifs: branchelseifs branchelseif
| ;
| branchelseif;
branch: branchif branchelseifs
| branchif branchelseifs branchelse;
identlist: Ident ',' identlist
| Ident
| ;
| Ident;
decl: type ':' identlist { DEBUG("Declaration"); };
decl: type ':' identlist;
definition: decl '=' expr { DEBUG("Definition"); };
assign: Ident '=' expr { DEBUG("Assignment"); };
sign: KeySigned
| KeyUnsigned
| ;
| KeyUnsigned;
scale: scale KeyShort
| scale KeyHalf
| scale KeyLong
| scale KeyDouble
| ;
| KeyShort
| KeyHalf
| KeyLong
| KeyDouble;
type: sign scale Ident
| sign scale KeyInt
| sign scale KeyFloat;
typekind: Ident
| KeyInt
| KeyFloat;
type: typekind
| scale typekind
| sign typekind
| sign scale typekind;
operation: oparith
| oplogic