aboutsummaryrefslogtreecommitdiff
path: root/10/main.l
diff options
context:
space:
mode:
authorAkshay <[email protected]>2021-04-30 17:52:13 +0100
committerAkshay <[email protected]>2021-04-30 17:52:13 +0100
commit8a57bedc04fff7a92ef6d2762cfe5fc17050f021 (patch)
tree192ea2a1bd2eec0c0f84a9cb7adc9b10d005e1db /10/main.l
parent30047205e440e9ad8984e1830b8b819b5fe1f9f7 (diff)
add yacc programs
Diffstat (limited to '10/main.l')
-rw-r--r--10/main.l22
1 files changed, 22 insertions, 0 deletions
diff --git a/10/main.l b/10/main.l
new file mode 100644
index 0000000..9962054
--- /dev/null
+++ b/10/main.l
@@ -0,0 +1,22 @@
1%{
2extern int yylval;
3%}
4
5d [0-9]+
6
7%%
8"+" return ADD;
9"-" return SUB;
10"*" return MUL;
11"/" return DIV;
12[0-9]+ {
13 yylval = atoi(yytext);
14 return NUM;
15};
16. return yytext[0];
17\n return 0;
18%%
19
20int yywrap() {
21 return 1;
22}