Running Lex and Yacc Program in ubuntu
Easy Ways Guide to Run Lex and Yacc Program on ubuntu
This post will show you how to run Lex and Yacc programs easily on ubuntu 12.04
I have assumed that you have a working Ubuntu 12.04 LTS version installed on your system and the computer is connected to the network
.
.
Ubuntu does not come installed with a lex and yacc compiler to do so install it first by
1. Opening the terminal
2. type sudo apt-get install flex
3. enter your password
after installation of flex finishes
4. type sudo apt-get install bison
5. enter your pasword.
Successfully Lex and Yacc have been installed on your system.
Running a Lex and Yacc program
1. write the lex program in a file and save it as file.l (where file is the name of the file).
2. open the terminal and navigate to the directory where you have saved the file.l (e.x CD Desktop)
3. type lex filename.l
4. then type cc lex.yy.c -lfl
5. then type ./a.out
Your lex progam will be running now (comment should be correct).
or compiling lex and yacc together
1. write lex program in a file file.l and yacc in a file file.y
2. open the terminal and navigate to the directory where you have saved the files.
3. type lex filename.l
4. type yacc filename.y
5. type cc lex.yy.c y.tab.h -lfl
The lex and yacc will run succesfully now send me your feedback:www.qooh.me/sbsuriya4
Comments
Post a Comment