%option noyywrap %option nounput %option noinput %{ #include #include using namespace std; #include "ast.hpp" #include #include #include "parser.tab.hpp" %} %% "def" return def_token; "extern" return extern_token; "if" return if_token; "then" return then_token; "else" return else_token; [#].* { } [a-z]+ { yylval.s = new string(yytext); return id_token; } [0-9]+(\.[0-9]+)? { yylval.d = atof(yytext); return num_token; } [()+*/;,<>-] return *yytext; [ \t\n] { } . { cerr << "Lekscika greska: neprepoznat karakter " << *yytext << endl; exit(EXIT_FAILURE); } %%