next up previous
Next: A detailed example Up: A first simple example Previous: The YACC corresponding file

Constructing the parser without Makefile

[moreno@iguanodon yacc]$ ls
bin  Makefile  ps  README  src  test
[moreno@iguanodon yacc]$ yacc -d src/calculator.y
[moreno@iguanodon yacc]$ ls
bin  Makefile  ps  README  src  test  y.tab.c  y.tab.h
[moreno@iguanodon yacc]$ flex src/calculator.l
[moreno@iguanodon yacc]$ ls
bin  lex.yy.c  Makefile  ps  README  src  test  y.tab.c  y.tab.h
[moreno@iguanodon yacc]$ gcc lex.yy.c y.tab.c -Wall -I./src -ll -o bin/calculator
lex.yy.c:1030: warning: `yyunput' defined but not used
src/calculator.y: In function `main':
src/calculator.y:18: warning: implicit declaration of function `yyparse'
y.tab.c: In function `yyparse':
y.tab.c:275: warning: implicit declaration of function `yylex'
[moreno@iguanodon yacc]$ ls bin/
calculator
[moreno@iguanodon yacc]$ ./bin/calculator 
> 2 + 7
9
> (6 - 5) * (11 + 4)
error: syntax error


next up previous
Next: A detailed example Up: A first simple example Previous: The YACC corresponding file
Marc Moreno Maza
2004-12-02