From 9b616c964b18d247a63183f828e9a5f410cb04a2 Mon Sep 17 00:00:00 2001 From: Gitea Date: Fri, 11 Dec 2020 00:56:13 -0600 Subject: [PATCH] some updates for yacc stuff --- bc/bc_parse.l | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/bc/bc_parse.l b/bc/bc_parse.l index e69de29..4e59275 100644 --- a/bc/bc_parse.l +++ b/bc/bc_parse.l @@ -0,0 +1,46 @@ +%{ + #include + #include "y.tab.h" +%} + +%% + +"/*"(\.)*"*/" ; +\n return NEWLINE; +\".\" yylval.string=strdup(yytext); return STRING; +[ \t] ; +\\\n ; +[0-9A-F]*(\.)?[0-9A-F]* yylval.number=atof(yytext); return NUMBER; +auto return AUTO; +break return BREAK; +define return DEFINE; +ibase return IBASE; +if return IF; +for return FOR; +length return LENGTH; +obase return OBASE; +quit return QUIT; +return return RETURN; +scale return SCALE; +sqrt return SQRT; +while return WHILE; +[a-z] yylval.letter_op=yytext[0]; return LETTER +[-+*/%^]?= return ASSIGN_OP; +=- ; +[*/%] yylval.letter_op=yytext[0]; return MUL_OP; +([=<>]?(=)?)|!= return REL_OP; +\+\+|-- yylval.num_op=strcmp(yytext, "++"); return INCR_DECR; +"(" return OPAREN; +")" return CPAREN; +, return COMMA; +"+" return PLUS; +- return MINUS; +; return SEMICOLON; +"[" return OSQR; +"]" return CSQR; +"^" return CARET; +"{" return OCURL; +"}" return CCURL; +<> return EOF; + +%% \ No newline at end of file