%{ #include #include #include #include "reg_izrazi.hpp" using namespace std; extern int yylex(); void yyerror(string s) { cerr << s << endl; exit(EXIT_FAILURE); } %} %union { RegEx *r; char c; } %type E E1 E2 %token basic_token %token slovo_token %% Program: Program Naredba | Naredba ; Naredba: basic_token E '\n' { cout << $2->basic() << endl; delete $2; } ; E: E '|' E1 { $$ = new Disj($1, $3); } | E1 { $$ = $1; } ; E1 : E1 E2 { $$ = new Concat($1, $2); } | E2 { $$ = $1; } ; E2: E2 '*' { $$ = new Iter($1); } | slovo_token { $$ = new Char($1); } | '(' E ')' { $$ = $2; } ; %% int main() { yyparse(); return 0; }