Homework 5
22C:50 Section 2, Fall 2000
Due Monday Sept 25, 2000, in class
Douglas W. Jones
-
To help get ready for MP2, examine the symbol table module in the
solution distributed to MP1, and examine the parser module, and pay
specific attention to the clear division between that part
of the symbol table having to do with storing the names of
identifiers, and that part of the symbol table having to do with
storing the values associated with those identifiers.
Part A: How does the modularization of the symbol table as
implemented in the solution to MP1 differ from that suggested in the
notes! One difference stands out!
Part B: Suggest a good reason for this change from what was
suggested in the notes.
-
To help get ready for MP2, examine the parser and the lexical analyzer
package and explain why this assembler ends up clogging up the symbol
table and string pool with identifiers that are found only in the
comments. (You can experiment with it! The assembler supports a -d
option that makes it append a listing of the the symbol table to the
assembly listing.)
Hint: This problem is a result of following the assignment quite
literally. The error is actually a consequence of the way comments are
handled in the grammar!
-
Do problem 3 at the end of Chapter 6.
-
Do problem 5 at the end of Chapter 6.
-
Do problem 6 at the end of Chapter 6.
Machine Problem 2
Due Monday Oct 2, 2000, in class
Modify the example solution to MP1 so that ...
- no text from within comments is ever included in the string pool.
- it correctly detects undefined labels and flags them as errors.
- it supports the extensions illustrated in Figure 5.3.
These are independent small changes to the program! They are listed in
what is probably the order of their difficulty.
You should only turn in listings of those
source files you had to change in order to solve the problem! Your
changes should fit seamlessly into the source that was distributed. Your
changes should conform to the "house style" for C programs.
Keep a clean on-line copy of your solution that you have not edited since
the due date. This can be used as proof of successful completion of the
assignment in the event of any questions about your solution! In the absence
of such questions, your score will depend only on the listings you turn in,
with special attention paid to clear acknowledgements, in header comments,
of any known deficiencies in your solution.