added parser rules for declaration, assignment, definition

This commit is contained in:
Sven Vogel 2024-04-26 16:53:41 +02:00
parent f6df192686
commit 3c0a885186
1 changed files with 29 additions and 1 deletions

View File

@ -56,7 +56,35 @@
%token FunExtsupport
%%
program: ;
program: assign
| definition;
expr: ValFloat
| ValInt
| ValMultistr
| ValStr
| Ident;
assign: Ident '=' expr { DEBUG("Assignment"); };
decl: type ':' Ident { DEBUG("Declaration"); };
definition: decl '=' expr { DEBUG("Definition"); };
sign: KeySigned
| KeyUnsigned
| ;
scale: scale KeyShort
| scale KeyHalf
| scale KeyLong
| scale KeyDouble
| ;
type: Ident
| sign scale KeyInt
| sign scale KeyFloat;
%%
int yyerror(char *s) {