blob: 9229af89323b01de6a6e99d186d0e2e45cf80f19 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
%{
extern int yylval;
%}
%%
"++" return INC;
"--" return DEC;
"+" return ADD;
"-" return SUB;
"*" return MUL;
"/" return DIV;
"=" return ASSIGN;
"==" return EQ;
"!=" return NEQ;
"<" return LT;
">" return GT;
"<=" return LTE;
">=" return GTE;
";" return ENDL;
"for" return FOR;
[0-9]+ {
yylval = atoi(yytext);
return NUM;
};
[a-zA-Z_][a-zA-Z_0-9]* return ID;
. return yytext[0];
\n return 0;
%%
int yywrap() {
return 1;
}
|