Merge pull request #60 from Servostar/parser-devel

Parser devel
This commit is contained in:
Filleo 2024-05-08 13:24:39 +02:00 committed by GitHub
commit 5604fab87b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 31 additions and 4 deletions

View File

@ -63,7 +63,8 @@
%left OpBitand OpBitor OpBitxor OpBitnot %left OpBitand OpBitor OpBitxor OpBitnot
%% %%
program: statementlist; program: statementlist
| fundef;
expr: ValFloat expr: ValFloat
| ValInt | ValInt
@ -75,10 +76,33 @@ expr: ValFloat
exprlist: expr ',' exprlist exprlist: expr ',' exprlist
| expr; | expr;
paramlist: '(' exprlist ')' paramlist argumentlist: argumentlist '(' exprlist ')'
| '(' exprlist ')'; | ;
funcall: Ident paramlist { DEBUG("Function call"); };
fundef: KeyFun Ident paramlist '{' statementlist'}' { DEBUG("Function");};
paramlist: paramlist '(' params ')'
| paramlist '(' ')'
| '(' params ')'
| '(' ')';
params: IOqualifyier paramdecl ',' params
| IOqualifyier paramdecl;
IOqualifyier: KeyIn
| KeyOut
| KeyIn KeyOut
| KeyOut KeyIn
| ;
paramdecl: type ':' Ident { DEBUG("Param-Declaration"); };
funcall: Ident argumentlist { DEBUG("Function call"); };
assign: Ident '=' expr { DEBUG("Assignment"); };
moduleimport: KeyImport ValStr { DEBUG("Module-Import"); };
statementlist: statement statementlist statementlist: statement statementlist
| statement; | statement;
@ -86,6 +110,7 @@ statementlist: statement statementlist
statement: assign statement: assign
| decl | decl
| definition | definition
| while
| branch | branch
| funcall; | funcall;
@ -99,6 +124,8 @@ branchelseifs: branchelseifs branchelseif
branch: branchif branchelseifs branch: branchif branchelseifs
| branchif branchelseifs branchelse; | branchif branchelseifs branchelse;
while: KeyWhile expr '{' statementlist '}' { DEBUG("while"); };
identlist: Ident ',' identlist identlist: Ident ',' identlist
| Ident; | Ident;