Semantic Actions #3 (Part 7 of 7)


Date assigned: 4/23/07
Date due: 5/9/07
Points: 100

You are to add all of the remaining semantic actions to your top-down parser to complete the entire compiler for our subset of C.

Remember, you will be graded on how well you coded the remaining semantic actions AND how well your compiler does overall with good testcases and testcases with errors; therefore, make sure you thoroughly test every module of your compiler.

Your compiler is to work as follows:

$ pcc file.c -option

where -option can be:
  -l  print source listing where each line is preceded by a line #
      print either 0 Errors, or all errors in the program AFTER the
        entire source listing is printed (only one error per line)
  -s  print the symbol table just prior to leaving each function
  -q  print out the quad file for the program
  -a  print out the souce listing and the quad file in that order
The output for each of the the above options must go to stdout. A program in L(program) as defined in the top-down parser assignment must produce a correct quad file called file.q (where file is an arbitrary filename specified in pcc file.c command) such that when file.q is run through the interpreter correct results are produced based on the code in file.c. We will go through all of the testcases in class on 5/9/07 beginning at 4pm.

At the beginning of class when this assignment is due, you are to hand in a complete listing of your entire compiler in the following order:

  1. Makefile
  2. defines.h / globals.h for Driver
  3. code for Driver
  4. defines.h / globals.h for ST
  5. code for ST
  6. defines.h / globals.h for Lex
  7. code for Lex
  8. defines.h / globals.h for Top-down parser
  9. code for Top-down parser
  10. defines.h / globals.h for Bottom-up parser
  11. code for Bottom-up parser
  12. defines.h / globals.h for Semantic Actions
  13. code for semantic actions
  14. defines.h / globals.h for other modules
  15. remaining code for other modules

Note1: Remember, your compiler is to be in a directory called yourlastname. In that directory there is to be a makefile that I simply use to compile your project creating the executable pcc. Continue creating subdirectories within yourlastname directory as needed. Also, continue to use subversion more than ever as we go back and modify existing code.

Note2: Use the submit script to submit your solution: zeus$ submit cs480s07 user.tar.g

Note3: Group .h and .c files together with the .h file preceding the .c file.

Note4: The completed listing is to be bound using a comb binder found in the Division office. This will take a little time, so do not put this off until the last minute or you will not be able to turn in your code on time.

Note5: Please name your testcases sa3.1.c, sa3.2.c, ... and submit all of the testcases you used to test your program in the tar file. Place all of these testcases in a directory called testfiles. Finally, your program might not be able to handle an all inclusive testcase, but I would like you to write one anyway. Call this testcase sa3all.c.

Note6: This portion of the compiler relies heavily on the bottom-up parser and semantic actions #2. You must allow yourself time to fix problems in your previous code.

Note7: There is no late grace period for this project. The final version of pcc is due no later than 4pm on 5/9/07.

Note8: No incompletes will be given for this course, so make sure you give yourself enough time to finish the entire project.


Douglas J. Ryan / ryandj@pacificu.edu