Yes...

By Onur Tosyali

Lex & Yacc - Compile And Run

Compiling lex & yacc (on unix command line)

Note: You must have written your lex and yacc codes beforehand. More on this later.

1)Compile and run a standalone lex code

-open command line
-write "emacs example.l"
(emacs, a text editor, opens. paste your code into there by right clicking the mouse once. ( yes, linux is weird))
-press ctrl-x ctrl-s to save
-press ctrl-x ctrl-c to close
-write "lex example.l"
-write "gcc -o example lex.yy.c" to compile
-write "./example" to run

2) compile and run a lex and yacc together

-open command line
-write "emacs example.l", press enter end right-click on space to paste your code
-press ctrl-x ctrl-s to save
-press ctrl-x ctrl-c to close
-write "emacs example.y", paste your yacc code and do the same as above

-write "lex example.l"
-write "yacc example.y"
-write "gcc -o example y.tab.c" to compile both your files
-write "./example" to run

No comments:

Post a Comment