Submission Due: the beginning of your lab session two weeks from when it was assigned
In this lab, you will be introduced to the csym compiler framework, which you will use to build and print a symbol table for the C-like language that the framework parses.
Begin the laboratory by downloading the csym source code and compiling that source code by issuing make in your console. This should build an executable named csym that can be tested by issuing make test in your console. At this point, the executable will fail with an error because you have not finished the laboratory yet.
The purpose of this laboratory is to build and print out a symbol table for the C-like language that the csym compiler framework parses. Much of the source code for the project has already been written. To complete the project, you will need to modify the following:
The enterblock, leaveblock, and dump functions in the file sym.c are stubs and must be completed
The fname, ftail, blockdcl, and btail functions in the file sem_sym.c are stubs and must be completed
Completing these functions means that you will need to build up the symbol table correctly and print out the symbol table at the correct time. Complete instructions and more details on the support functions will be given at the beginning of the laboratory.
Reference Output
The reference output for the test input file temp.c, which is distributed with the project template, is shown below. In the output, the first column is the name of the declared variable, the second column is the block level, the third column is the type value, and the fourth column is the defined boolean signifying that the identifier has been declared and is currently in scope. The variable name and block level are the most important elements of the output (and are the columns that you will be required to print - the other columns are optional).
Dumping identifier table bd_loc2 5 4 1 b_loc1 5 1 1 Dumping identifier table loc1 4 1 1 loc2 4 1 1 d_arr 4 20 1 d_loc 4 4 1 Dumping identifier table Dumping identifier table int_glob 2 1 1 d_glob 2 4 1
For this lab, you will be graded on a working demonstration of your csym compiler for the C-like language at the beginning of the next lab, as well as, a 1-2 page report. The tar file should contain your lab 6 directory, the report, and the output of your demo (in the format detailed by the Deliverables link). I should be able to run, build, and test your submission using the Makefile provided to you. The report should include the objective of this lab, as well as, describe how your program works at a high level. You should discuss the functionality of the resulting design and explain why your implementation of this project works. Also, briefly discuss any troubles you had in writing and testing this program. Make sure to make clean your project and remove any debugging flags you added before submission.