Notatka z wykładu. Po // są komentarze, ICH NIE PISZEMY NA TABLICY!
// lex z przykladow do wykladu nr 12
// a teraz bizon:
// definicje
%{
include costam.h
%}
%token NUM
%% // teraz gramatyka
input : /* nic */
| input expr "\n" {printf("\n");}; // daje printf ktore 'przywroci koniec linii'
expr : expr '+' mult { printf("+");};
| expr '-' mult { printf("-");};
| mult; // zejscie nizszego rzedu (??)
mult : mult '*' term { printf("*");};
| mult '/' term { printf("/");};
| term;
term : NUM { printf("%d", $1);};
| '(' expr ')';
%% // main
int main()
{
yyparse();
return 0;
}