diff --git a/src/lex/lexer.l b/src/lex/lexer.l index eb0ca18..1d5b9c2 100644 --- a/src/lex/lexer.l +++ b/src/lex/lexer.l @@ -15,6 +15,8 @@ %% "\n" yyLineNumber++; +#.* ; + ":" {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(')');}; diff --git a/src/yacc/parser.y b/src/yacc/parser.y index 2ee4e7d..e4cc3fa 100644 --- a/src/yacc/parser.y +++ b/src/yacc/parser.y @@ -56,8 +56,8 @@ %token FunExtsupport %% -program: assign - | definition; +program: statement; + expr: ValFloat | ValInt @@ -65,7 +65,9 @@ expr: ValFloat | ValStr | Ident; -assign: Ident '=' expr { DEBUG("Assignment"); }; +statement: assign + | decl + | definition; identlist: Ident ',' identlist | Ident @@ -75,6 +77,8 @@ decl: type ':' identlist { DEBUG("Declaration"); }; definition: decl '=' expr { DEBUG("Definition"); }; +assign: Ident '=' expr { DEBUG("Assignment"); }; + sign: KeySigned | KeyUnsigned | ; @@ -89,8 +93,6 @@ type: sign scale Ident | sign scale KeyInt | sign scale KeyFloat; - - %% int yyerror(char *s) {