Assignment 2, due June 18

Includes Machine Problem 1, due June 19

Part of the homework for 22C:50, Summer 2003
by Douglas W. Jones
THE UNIVERSITY OF IOWA Department of Computer Science

 

Machine Problem 1

Ground rules: This program involves making changes to the software distributed on the web at

http://homepage.cs.uiowa.edu/~dwjones/syssoft/hw/mp0.txt

This is a large multi-file C program. It should conform to the C programming style documented in

http://homepage.cs.uiowa.edu/~dwjones/syssoft/style.html

Failure to conform to this style will be penalized! Note the rules for commenting! As distributed, the code is version 0.0! Your revision (MP1) should be version 0.1, and it should have your name as the author, with appropriate additions made to the revision history!

All assignments for this class are to be turned in on paper! When you modify a multi-file program, turn in only the listings of the files you changed. Always, in addition, turn in a listing of a test file that demonstrates your work. Failure to test will be penalized. Clear documentation of errors or unimplemented parts of your solution will reduce the penalty for incomplete work.

The main assignment: The assembler, as distributed, supports only base 10 and base 16 numbers. Add support for arbitrary number bases using the notation:

	<base>#<number>
Where <base> is a number base, expressed in decimal, and <number> is a number expressed in that base. The allowed bases are from 2 to 36; digits greater than 9 are expressed using letters (either upper or lower case), with A representing the value 10 and Z representing 35. This enhancement to the program will require at most a few tens of lines of code, all in the same source file.

Secondary assignments: Lines 44 to 46 of the test file distributed with the EAL assembler demonstrate bugs in the assembler's error reporting. Fix at least one of them!

Homework 2

  1. Clearly describe the errors mentioned at the end of the assignment for MP1. (Don't explain how to fix them, just explain what the EAL assembler, version 0.0, didn't do correctly.)

  2. Redo the definition of <number> from Figure 2.18 (on page 20 of the notes) to handle the requirements of MP1.

  3. Redraw figure 2.19 (on page 21 of the notes) to handle the requirements of MP1.

  4. In the EAL assembler, the symbol table package includes a definition of table that holds the stringpool handles of symbols. Where are the associated values stored? Explain, in terms of data abstraction, why it might be a good idea to store the values somewhere else instead of storing them in a data structure declared locally to the symbol table package?

  5. If you examine the result of assembling lines 17 to 21 of the test file distributed with the EAL assembler, you can determine, without ever looking at the source code, how the EAL assembler processes forward references. How does the EAL assembler process forward references, and what is it about lines 17 to 21 that discloses this?