-
Notifications
You must be signed in to change notification settings - Fork 1
/
project.l
96 lines (95 loc) · 2.53 KB
/
project.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
%{
#include <stdio.h>
#include <string.h>
#include "y.tab.h"
%}
Digit [0-9]
Alphabetic [A-Za-z]
%%
"//"([a-z]|[0-9]|[A-Z]|" ")* {}
[/][*][^*]*[*]+([^*/][^*]*[*]+)*[/] {}
int return (INT);
float return (FLOAT);
bool return (BOOL);
void return (VOID);
char return (CHAR);
string return (STR);
false return (FALSE);
true return (TRUE);
"&&" return (AND_OP);
"||" return (OR_OP);
if return (IF);
elif return (ELIF);
else return (ELSE);
while return (WHILE);
for return (FOR);
continue return (CONTINUE);
break return (BREAK);
func return (FUNC);
return return (RETURN);
"<=" return (LESS_EQ_OP);
">=" return (GREATER_EQ_OP);
"!=" return (NOT_EQ_OP);
"==" return (EQUALITY_OP);
"<" return (LESS_OP);
">" return (GREATER_OP);
"=" return (EQUAL_OP);
"*" return (MULTIPLY_OP);
"/" return (DIVIDE_OP);
"-" return (SUB_OP);
"+" return (ADD_OP);
"^" return (POW_OP);
"%" return (MOD_OP);
"!" return (NOT_OP);
";" return (SEMICOLON);
"{" return (CURLY_OPEN);
"}" return (CURLY_CLOSE);
"(" return (LEFT_PARANT);
")" return (RIGHT_PARANT);
"[" return (SQR_OPEN);
"]" return (SQR_CLOSE);
"," return (COMMA);
"$" return (DOLLAR_SIGN);
gps return (GPS);
road return (ROAD);
crossroad return (CROSSROAD);
graph return (GRAPH);
user return (USER);
showonmap return (BLTIN_SHOW_ON_MAP);
searchlocation return (BLTIN_SEARCH_LOCATION);
getroadspeed return (BLTIN_GET_ROAD_SPEED);
getlocation return (BLTIN_GET_LOCATION);
showtarget return (BLTIN_TARGET);
getroads return (BLTIN_GET_ROADS);
getcrossroads return (BLTIN_GET_CROSSROADS);
getcrossroadsnum return (BLTIN_GET_CROSSROADS_NUM);
getroadsnum return (BLTIN_GET_ROADS_NUM);
colloborateusers return (BLTIN_COLLOBORATE_USERS);
intructuser return (BLTIN_INSTRUCT_USER);
increasescoreofroad return (BLTIN_INCREASE_SCORE_OF_ROAD);
decreasescoreofroad return (BLTIN_DECREASE_SCORE_OF_ROAD);
getscoreofroad return (BLTIN_GET_SCORE_OF_ROAD);
showroadonmap return (BLTIN_SHOW_ROAD_ON_MAP);
showcrossroadonmap return (BLTIN_SHOW_CROSSROAD_ON_MAP);
addcrossroad return (BLTIN_ADD_CROSSROAD);
addroad return (BLTIN_ADD_ROAD);
print return (BLTIN_PRINT);
home return (HOME);
hospital return (HOSPITAL);
school return (SCHOOL);
bridge return (BRIDGE);
mall return (MALL);
busstop return (BUSSTOP);
hotel return (HOTEL);
postoffice return (POSTOFFICE);
{Digit}+ { sscanf(yytext, "%d", &yylval);
return (INT_LITERAL);
}
{Digit}*"."{Digit}+ return (FLOAT_LITERAL);
\"(\\.|[^\\"])*\" return (STR_LITERAL);
\'(\\.|[^\\'])+\' return (CHAR_LITERAL);
{Alphabetic}({Digit}|{Alphabetic})* return (IDENT);
(\r|\n|\r\n) yylineno++;
[ \t\v\f]+ {};
. { yyerror("Non recognized!"); }
%%