Posted by: sirivy | April 1, 2009

Compile yacc & lex file with option.

1st> yacc -d yaccfilename.y

=> This command will generate 2 following files “y.tab.h” and “y.tab.c”.

If you meet error ” ‘yylval’ undeclared (first use in this function)” ,

you should try to compile yacc file with option d. Becuase option d will also produce header file(y.tab.h) for you.

2nd> lex lexfilename.l

=> This command will generate lex.yy.c.

3rd> gcc y.tab.c lex.yy.c -ll -ly -o arbitraryoutputname

4th> ./arbitraryoutputname


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: