-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathscanner.l
42 lines (37 loc) · 1.07 KB
/
scanner.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
%{
#include <stdlib.h>
#include "parser.tab.h"
%}
digito [0-9]
vocal [aeiou]
letra [aeiou_]
constante ({digito})+
identificador {letra}({letra}|{digito})*
cadena {vocal}{letra}*
%%
"=" {return OPERADOR;}
"." {return PUNTO;}
";" {return PUNTOYCOMA;}
"[" {return CORCHIZQ;}
"]" {return CORCHDER;}
"a_a_a" {return PALABRA;}
"e_e_i" {return REPETIR;}
"u_e_o" {return NUMERO;}
"o_a_e" {return MOSTRAME;}
"i_i_i_o" {return INICIO;}
"i_a" {return FINAL;}
{cadena} {return CADENA;}
{identificador} {return ID;}
{constante} {return CONSTANTE;}
. {printf("Error lexico\n");}
%%
/*
int yyerror(void){
printf("Error lexico.");
}
int main (int argc, char** argv){
yylex();
fclose(yylex);
return 0;
}
*/