%option noyywrap %option nounput %{ #include #include using namespace std; #include "ast.hpp" #include #include #include "parser.tab.hpp" %} %% "def" return def_token; "extern" return extern_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); } %%