-
Notifications
You must be signed in to change notification settings - Fork 0
/
parla.l
51 lines (41 loc) · 1.15 KB
/
parla.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
%{
#include <stdlib.h>
#include "main.h"
#include "y.tab.h"
#define LOOKUP 0
%}
%s COMMENT
%%
^[ \t]*\*\* { BEGIN COMMENT; }
^[ \t]*\*\*[ \t]*.*[ \t]*\*\*\n { }
[a-z] { yylval.sIndex = *yytext - 'a'; return VARIABLE; }
-?[0-9]* { yylval.iValue = atoi(yytext); return INTEGER; }
[eE][-+]?[0-9]*\.[0-9]+ { yylval.iValue = atoi(yytext); return FLOAT; }
([-()<>=+*/;{}.,:]) { return *yytext;}
\*\*.*\*\* { return COMMENT; }
#.* /* Possibilita o uso de she-bang */
">=" return GE;
"<=" return LE;
"==" return EQ;
"!=" return NE;
"bchar" return BCHAR_TYPE;
"set" return DEFTOKEN;
"do" return '{';
"echar" return ECHAR_TYPE;
"else" return ELSE;
"end" return '}';
"if" return IF;
"into" return INTO;
"like" return TYPETOKEN;
"load" return LOADTOKEN;
"say" return PRINT;
"say bye" return QUIT;
"say details about" |
"about" return INSPECT;
"while" return WHILE;
\n return EOL;
[ \t] /* Ignorar espaço em branco e tab */
%%
int yywrap(void) {
return 1;
}