Skip to content

Skm26/CD-lab-programs

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CD-lab-programs

2020 Compiler Design Lab Programs

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

  1. type sudo apt-get install bison
  2. enter your password.

Lex and Yacc have been Successfully installed on your system.

Running a Lex and Yacc program

  1. write the lex program in a file and save it as file.l
  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 program 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 -d filename.y
  5. type cc lex.yy.c y.tab.c -lfl
  6. type ./a.out

The lex and yacc will run succesfully now

About

2020 Compiler Design Lab Programs

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 98.0%
  • Other 2.0%