aboutsummaryrefslogtreecommitdiff
path: root/11/main.l
diff options
context:
space:
mode:
Diffstat (limited to '11/main.l')
-rw-r--r--11/main.l33
1 files changed, 33 insertions, 0 deletions
diff --git a/11/main.l b/11/main.l
new file mode 100644
index 0000000..5cc2a4e
--- /dev/null
+++ b/11/main.l
@@ -0,0 +1,33 @@
1%{
2#include "y.tab.h"
3extern int yylval;
4%}
5
6%%
7"++" return INC;
8"--" return DEC;
9"+" return ADD;
10"-" return SUB;
11"*" return MUL;
12"/" return DIV;
13"=" return ASSIGN;
14"==" return EQ;
15"!=" return NEQ;
16"<" return LT;
17">" return GT;
18"<=" return LTE;
19">=" return GTE;
20";" return ENDL;
21"for" return FOR;
22[0-9]+ {
23 yylval = atoi(yytext);
24 return NUM;
25};
26[a-zA-Z_][a-zA-Z_0-9]* return ID;
27. return yytext[0];
28\n return 0;
29%%
30
31int yywrap() {
32 return 1;
33}