-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathparser.l
More file actions
25 lines (20 loc) · 833 Bytes
/
parser.l
File metadata and controls
25 lines (20 loc) · 833 Bytes
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
/*** Author: Tamer Elsawaf ***/
/*** Systems Programming / STATEMENT PARSER Project 3 */
%{
#include <stdio.h>
using namespace std;
#include "parser.tab.h"
%}
%%
[a-zA-Z][a-zA-Z0-9]* {yylval.print = strdup(yytext); return ID; printf(yytext);}
; {return EOL;}
\( {return OPENBracket;}
\) {return CLOSEBracket;}
[0-9] ;
[-+*/%] {yylval.print = strdup(yytext); return OP;}
= {return EQU;}
\r ;
\n {return NEWLINE;}
[[:space:]] ;
. { return NASymbol; }
%%