Project 1 - Lex

*  Due: Friday, February 25, 5pm.

 

*   Assignment handout:project1.pdf.

           

*  You should handin in paper you lex program and the output of your program for each of the 5 test files:

test1, test2, test3, test4, test5.

 

*  Lex manual: lex.pdf. A useful link: Lex&Yacc.

 

*  Lex slides: Lex.ppt.

           

*  Here are the lex programs presented in the lex slides: example1.l, example2.l.

 

*  A simple unix script file for compiling your lex programs: lex-script.
Run "lex-script filename", where filename.l is your lex program and filename will be the resulting executable. (Remember to change the permission of the script file to executable before you use it.)

 

Project 2 – Yacc

*  Due: Friday April 8 5pm.

           

*  Assignment handout:project2.pdf

 

*  You should handin in paper you lex and yacc program and the output of your program for each of the 5 test files of Project 1 given above.

 

*  Yacc manual: yacc.pdf. A useful link: Lex&Yacc.

 

*  Yacc slides: Yacc.ppt.

 

*  Here are the yacc and lex example programs in the yacc slides (the ".l" are lex files while the ".y" are the respective yacc files):

  1. expr1.l, expr1.y: parser for programs that print the result of one expression.
        Try it with input file test-expr1.
  2. expr2.l, expr2.y: parser for programs that print the result of consecutive expressions seperated with ';'
        Try it with input file test-expr2.
  3. expr3.l, expr3.y: parser for programs that implement the print statement for expressions and strings.
        Try it with input file test-expr3.

 

*  A simple unix script file for compiling your yacc programs: yacc-script.
Run "yacc-script filename", where filename.l and filename.y is your lex and yacc program and filename will be the resulting executable. (Remember to change the permission of the script file to executable before you use it.)