Search code examples
yacclex

How to compile Lex & yacc in Windows 7?


How to complie these in a Windows 7 Pc?

% lex chl-n.1
% yacc -d chl-m.y
% cc -c 1ex.yy.c y.tab.c
% cc -0 example-m.n 1ex.yy.o y.tab.0 -11

is it like this?

flex my_code.l
bison -y -d my_code.y
gcc -c y.tab.c lex.yy.c
gcc y.tab.o lex.yy.o my_code.c -o my_code.exe

but my last code is not working, it says "gcc: my_code.c: No such file or Directory". This is a example code from O'really Book (ch1-05 page36). C file is not generating.


Solution

  • cc and gcc are typical linux tools. They don't come installed in windows.

    An easy way to get them is installing cygwin.

    A step-by-step tutorial is available here

    http://www.eecg.utoronto.ca/~aamodt/ece242/cygwin.html