diff --git a/lexer.l b/lexer.l index 24667b6..0c8fc1a 100644 --- a/lexer.l +++ b/lexer.l @@ -42,6 +42,7 @@ elif return ELIF; {letter}({letter}|{digit}|[?.-])* yylval.sym = yytext; return ID; "<-" return GETS; "->" return MAPS; +".." return CAT; [(){}.,*/+-] return yytext[0]; [\t ] // Eat whitespace not first on a line "/"\n // Eat newlines ending in / diff --git a/parser.y b/parser.y index 09df882..edd6971 100644 --- a/parser.y +++ b/parser.y @@ -19,6 +19,7 @@ int yyerror(const char* p) { fprintf(stderr, p); } %token IF ELIF ELSE %right GETS +%left CAT %left '+' '-' %left '/' '*' %left MAPS @@ -34,6 +35,7 @@ assignments: assignments assignment STOP | // null production; expr: funcdef | funcall | objdef + | expr CAT expr | expr '+' expr | expr '-' expr | expr '*' expr