aboutsummaryrefslogtreecommitdiff
path: root/12/main.l
diff options
context:
space:
mode:
authorAkshay <[email protected]>2021-05-07 06:07:28 +0100
committerAkshay <[email protected]>2021-05-07 06:07:28 +0100
commit896e4859333c6be801391ae9bbeec425f6e32f86 (patch)
treee1f100a81c1dccce2bf8aa546b8ef4b538d9e666 /12/main.l
parentda1764a9f839e1d29b2bee12d35534f71f05c6ff (diff)
add prog 12: function definition
Diffstat (limited to '12/main.l')
-rw-r--r--12/main.l44
1 files changed, 44 insertions, 0 deletions
diff --git a/12/main.l b/12/main.l
new file mode 100644
index 0000000..2fa1b44
--- /dev/null
+++ b/12/main.l
@@ -0,0 +1,44 @@
1%{
2extern int yylval;
3%}
4
5%%
6"void" return VOID;
7"int" return INT;
8"float" return FLOAT;
9"double" return DOUBLE;
10"char" return CHAR;
11"unsigned" return UNSIGNED;
12"long" return LONG;
13"return" return RET;
14"for" return FOR;
15"if" return IF;
16"else" return ELSE;
17"," return COMMA;
18"(" return LPAREN;
19")" return RPAREN;
20"{" return LBRACE;
21"}" return RBRACE;
22";" return ENDL;
23"++" return INC;
24"--" return DEC;
25"+" return ADD;
26"-" return SUB;
27"*" return MUL;
28"/" return DIV;
29"=" return ASSIGN;
30"==" return EQ;
31"!=" return NEQ;
32"<" return LT;
33">" return GT;
34"<=" return LTE;
35">=" return GTE;
36[a-zA-Z_][a-zA-Z_0-9]* return ID;
37. ;
38\n ;
39<<EOF>> return 0;
40%%
41
42int yywrap() {
43 return 1;
44}