Skip to content
Snippets Groups Projects
Commit 566f158a authored by albruiz's avatar albruiz
Browse files

Delete a_lex.l

parent 93a1a14e
No related branches found
No related tags found
No related merge requests found
%{
#include<stdio.h>
#include"y.tab.h"
int pos = 0;
%}
%%
"true" {
pos++;
yylval.logico = 1;
return (BOOLEANO);
}
"false" {
pos++;
yylval.logico = 0;
return (BOOLEANO);
}
. {
pos++;
yylval.caracter = yytext;
return (CARACTER);
}
"if" {
pos++;
return (IF);
}
"else" {
pos++;
return (ELSE);
}
"do" {
pos++;
return (DO);
}
"while" {
pos++;
return (WHILE);
}
"printf" {
pos++;
return (PRINTF);
}
"scanf" {
pos++;
return (SCANF);
}
"var" {
pos++;
return (VAR);
}
"sin" {
pos++;
return (SIN);
}
"cos" {
pos++;
return (COS);
}
"tan" {
pos++;
return (TAN);
}
"arcsin" {
pos++;
return (ARCSIN);
}
"arccos" {
pos++;
return (ARCCOS);
}
"arctg" {
pos++;
return (ARCTG);
}
"mcm" {
pos++;
return (MCM);
}
"mcd" {
pos++;
return (MCD);
}
"log" {
pos++;
return (LOG);
}
[0-9]+(\.[0-9]+)? {
pos++;
yylval.real = atof(yytext);
return (DIGITO);
}
([a-z]|[A-Z]|"_")+ {
strcpy(yylval.cadena,yytext);
return (NOMBRE);
}
("+"|"-"|"*"|"/"|"^"|"("|")"|";"|"|"|"&"|"!"|">"|">="|"<"|"<="|"=="|"!=") {
return yytext[0];
}
%%
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment