created lexer rule for comments
deleted lexer rule for '#' added parser rule for statement sorted parser rules
This commit is contained in:
parent
897de1b8e1
commit
6de4196c0a
|
@ -15,6 +15,8 @@
|
||||||
%%
|
%%
|
||||||
"\n" yyLineNumber++;
|
"\n" yyLineNumber++;
|
||||||
|
|
||||||
|
#.* ;
|
||||||
|
|
||||||
":" {DEBUG("\"%s\" tokenized with \':\'", yytext); return(':');};
|
":" {DEBUG("\"%s\" tokenized with \':\'", yytext); return(':');};
|
||||||
"=" {DEBUG("\"%s\" tokenized with \'=\'", yytext); return('=');};
|
"=" {DEBUG("\"%s\" tokenized with \'=\'", yytext); return('=');};
|
||||||
"+" {DEBUG("\"%s\" tokenized with \'+\'", yytext); return('+');};
|
"+" {DEBUG("\"%s\" tokenized with \'+\'", yytext); return('+');};
|
||||||
|
@ -24,7 +26,6 @@
|
||||||
"," {DEBUG("\"%s\" tokenized with \',\'", yytext); return(',');};
|
"," {DEBUG("\"%s\" tokenized with \',\'", yytext); return(',');};
|
||||||
";" {DEBUG("\"%s\" tokenized with \';\'", yytext); return(';');};
|
";" {DEBUG("\"%s\" tokenized with \';\'", yytext); return(';');};
|
||||||
"." {DEBUG("\"%s\" tokenized with \'.\'", yytext); return('.');};
|
"." {DEBUG("\"%s\" tokenized with \'.\'", yytext); return('.');};
|
||||||
"#" {DEBUG("\"%s\" tokenized with \'#\'", yytext); return('#');};
|
|
||||||
|
|
||||||
"(" {DEBUG("\"%s\" tokenized with \'(\'", yytext); return('(');};
|
"(" {DEBUG("\"%s\" tokenized with \'(\'", yytext); return('(');};
|
||||||
")" {DEBUG("\"%s\" tokenized with \')\'", yytext); return(')');};
|
")" {DEBUG("\"%s\" tokenized with \')\'", yytext); return(')');};
|
||||||
|
|
|
@ -56,8 +56,8 @@
|
||||||
%token FunExtsupport
|
%token FunExtsupport
|
||||||
|
|
||||||
%%
|
%%
|
||||||
program: assign
|
program: statement;
|
||||||
| definition;
|
|
||||||
|
|
||||||
expr: ValFloat
|
expr: ValFloat
|
||||||
| ValInt
|
| ValInt
|
||||||
|
@ -65,16 +65,36 @@ expr: ValFloat
|
||||||
| ValStr
|
| ValStr
|
||||||
| Ident;
|
| Ident;
|
||||||
|
|
||||||
assign: Ident '=' expr { DEBUG("Assignment"); };
|
statement: assign
|
||||||
|
| decl
|
||||||
|
| definition;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
identlist: Ident ',' identlist
|
identlist: Ident ',' identlist
|
||||||
| Ident
|
| Ident
|
||||||
| ;
|
| ;
|
||||||
|
|
||||||
|
|
||||||
decl: type ':' identlist { DEBUG("Declaration"); };
|
decl: type ':' identlist { DEBUG("Declaration"); };
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
definition: decl '=' expr { DEBUG("Definition"); };
|
definition: decl '=' expr { DEBUG("Definition"); };
|
||||||
|
|
||||||
|
assign: Ident '=' expr { DEBUG("Assignment"); };
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
sign: KeySigned
|
sign: KeySigned
|
||||||
| KeyUnsigned
|
| KeyUnsigned
|
||||||
| ;
|
| ;
|
||||||
|
@ -89,8 +109,6 @@ type: sign scale Ident
|
||||||
| sign scale KeyInt
|
| sign scale KeyInt
|
||||||
| sign scale KeyFloat;
|
| sign scale KeyFloat;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
%%
|
%%
|
||||||
|
|
||||||
int yyerror(char *s) {
|
int yyerror(char *s) {
|
||||||
|
|
Loading…
Reference in New Issue