-
Notifications
You must be signed in to change notification settings - Fork 1
/
For.l
36 lines (31 loc) · 816 Bytes
/
For.l
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
33
34
35
36
%{
#include <stdio.h>
#include "y.tab.h"
%}
Knostar [^*]*
Nostarfwd [^*/]
Pstar [\*]+
alpha [A-Za-z_]
digit [0-9]
%%
[\t\n\ ] ;
"/*"{Knostar}{Pstar}({Nostarfwd}{Knostar}{Pstar})*"/" ;
"//".* ;
for return FOR;
continue return CON;
break return BREAK;
{digit}+ return NUM;
{alpha}({alpha}|{digit})* return ID;
"<=" return LE;
">=" return GE;
"==" return EQ;
"!=" return NE;
"||" return OR;
"&&" return AND;
{digit}+("++"|"--")|("++"|"--"){digit}+ yyerror("lvalue is required as operand");
. return *yytext;
%%
int yywrap()
{
return 1;
}