-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlex.l
61 lines (48 loc) · 1.94 KB
/
lex.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
%{
#include "grammar.tab.h"
#include "Includes.hpp"
//int yylineno = 0;
%}
%%
Dark_Lady_Watch_Over_You {return FORSAKEN_BEGIN;}
; {return SEMICOLON;}
[1-9][0-9]* {return INTEGER;}
0 {return INTEGER;}
[0-9]+\.[0-9]+ {return REAL;}
May_My_Aim_Be_True {return TRUE;}
Of_Course_Not {return FALSE;}
I_Deserve_Clean_Death {return EXIT;}
I_Get_What_I_Want {return INPUT;}
Rise {return INICIALIZE;}
Have_Something_For_Me {return ASSIGN;}
Is_There_A_Problem {return IF;}
Let_None_Survive {return WHILE;}
Speak_Quickly {return PRINT;}
A_Long_Dead_Memory {return NUL;}
I_Have_No_Time_For_Games {return FORSAKEN_END;}
"-" {return MINUS;}
Betray {return NEGATIVE;}
Absolute {return ABSOLUTE;}
[sS][iI][nN] {return SIN;}
[cC][oO][sS] {return COS;}
[sS][qQ][rR][tT] {return SQRT;}
Resurrect {return ADD;}
Slaughter {return SUBSTRACT;}
Procreate {return MULTIPLY;}
Enslave {return DIVIDE;}
Join_The_Horde_As_Equals {return EQUAL;}
We_Are_The_Forsaken {return GT;}
Enemies_Abound {return LT;}
"(" {return OPEN_PARENTHESIS;}
")" {return CLOSE_PARENTHESIS;}
"{" {return OPEN_BRACES;}
"}" {return CLOSE_BRACES;}
[a-zA-Z] {return VAR;}
[ \t] ;
[\n] { yylineno++; }
. {printf("Lex: Unexpected character %s.\n", yytext ); return 0;}
%%
int yywrap(void)
{
return 1;
}