some updates for yacc stuff
This commit is contained in:
parent
0743955d90
commit
9b616c964b
1 changed files with 46 additions and 0 deletions
|
@ -0,0 +1,46 @@
|
|||
%{
|
||||
#include <string.h>
|
||||
#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;
|
||||
<<EOF>> return EOF;
|
||||
|
||||
%%
|
Loading…
Reference in a new issue