Assignment 3, due Sept 15

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

Machine Problem I, due Wed Sept 24

The set of operators allowed in expressions in our example assembler is limited, only addition, subtraction, logical and and logical or. Extend the assembler so it supports the following additional binary operators within expressions:

Solving this assignment will involve a significant amount of code in the expression evaluator, plus a little code in the lexical analyzer. In writing your code, pay special attention to the style guidelines for comments where it suggests notation for comments on lines changed in one version of the code from the previous version. You should annotate every line you change with the marginal comment /*V1.0*/ to indicate your changes! You should also update the Makefile to indicate that this is version 1.0 of the EAL assembler.

Turn in: listings of each file you changed, properly commented so that it is very easy to see the changes you made. Also turn in an assembly listing of an EAL test file you created that thoroughly tests your changes to the assembler.

Mandatory: Once you turn in your solution, do not make further changes to any files in the directory where you built version 1.0. All future assignments that involve changes to EAL should be done in another directory, so that you can use the date-of-last-edit information in version 1.0 as proof of the data on which you did your work.

Homework

Always, on every assignment, please write your name legibly as it appears on your University ID and on the class list! All assignments will be due at the start of class on the day indicated, and unless there is what insurance companies call "an act of Godt" (something outside your control), the only exceptions to this rule will be by advance arrangement.

  1. Do Chapter 3 Problem 5 from the notes.

  2. How does the EAL assembler distributed in

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

    handle string pool overflows? This question applies not only to the string pool package stringpool.c, but to the whole assembler. (Note: the default string pool is set very small; one way to solve this problem is to read lots of code, but it might help you understand the code if you experiment by defining a bunch of really long identifiers to see what happens.)

    The Unix/Linux grep command is very handy. Type grep POOLSIZE * at a shell prompt, and you will get a list of all lines of all files in your directory that use the identifier POOLSIZE (where each line is output with a prefix giving the filename). You can limit the search to just C source files by using grep POOLSIZE *.c

  3. How does the example assembler compute the hash function it uses? Hint: Two distinct modules in the assembler are involved! You might find it useful to think about Chapter 3 Problem 10 in answering this question.

  4. Write and assemble a small EAL program that conclusively demonstrates that EAL does not use chaining and that EAL does use two passes!

  5. Do Chapter 4, Problem 5.