CST 8152 - Assignment 7 (Final)
Program output and source code due in Labs, August 6-7, 1997
The due date for the final assignment cannot be extended. I am away August 12-15.
Date Assigned: Wednesday, July 23, in class
Last Update: Sunday September 27, 1998 01:06
Purpose
This assignment finishes the basic interpreter by adding the Symbol Table to hold the results of the expressions you
parse.
Instructions
Following the code outline given in the class notes, design, write, and thoroughly test
a symbol table data structure. (Test the interface functions to the table thoroughly, on
their own, before you use them in your parser!)
Add the symbol table to your Parser.
Identifiers are entered in to the symbol table in assignment statements; the values of
identifiers in the symbol table are looked up when used in expressions.
Develop test files that use the Print statement to print
complex expressions using variables to verify that your symbol table, stack, and
expression handling works. Use the Dump statement to debug
entries in your symbol table.
Important Notes
Memory management
- Like the lexical analyser, the symbol table manages its own memory. If the symbol table
needs to keep a copy of a string passed in to it, it will allocate the memory itself (and
free it later, too).
- If your symbol table is a fixed size, make sure your program detects when it is full. Do
not overwrite memory.
- If the string buffers in your symbol table are a fixed size, decide what to do about
identifiers and strings that are too long for the buffers. Will your interpreter function
using truncated identifiers?
Clearing the symbol table
- If your parser handles multiple input files, ensure that your symbol table starts empty
at the beginning of each new file. Nothing should be left in the table from the previous
file.
Run-time semantic checking
- Ensure that run time semantic checking (divide-by-zero, type checking, etc.) works for
variables as well as for simple constants.
See also the important notes from Assignment Five.
Deliverables for this assignment
- At the beginning of each Lab period on the dates given above, I will give each Lab
section the URL of a different test input file consisting of many print
statements containing lots of constants, strings, and variables in expressions. You must
run the input file against your program and print and hand in the output of your program
before the Lab ends. (Please identify your output using the usual assignment submission
guidelines.)
- You will deposit your complete working Assignment 7 source code into the indicated
directory on the Algonquin server during the Lab period. The size of the source code
precludes a full examination of its quality; but, I will be checking for clean layout,
Algonquin standard coding, and good comment conventions. I also check to see that the
Algonquin course plagiarism rules have been followed.
If you cannot produce
output from your program in the assigned Lab period, arrange an appointment with me to
demonstrate your assignment and submit your source code late. I cannot accept output after
the Lab period ends; you must make an appointment with me and I will hand you another test
file to run and collect your source code after you have compiled and run the test.
I am attending a professional development seminar in Kingston August 12-15 and will not
be in town to see late assignment demos during this time, nor can I see demos while I am
proctoring exams.
Ian D. Allen CST 8152 Home Page