October 13, 2009

I have written a replacement for "asm.c" that uses
much simpler data structures.  If you wish to use
it, download "gvcasm.c" from my examples directory:

http://www.student.cs.uwaterloo.ca/~cs241/egsgvc/

NOTE 1:  gvcasm.c enforces a limit on the maximum
line length, the maximum number of lines, and
the maximum number of unique labels.  These limits
are sufficient to pass the Marmoset tests and may
be assumed to be added to the MIPS assembly language
specification.

NOTE 2:  If you use gvcasm.c for assignment 4 you
will have to discard your code for assignment 3.
It might be worthwhile to do so if you are struggling
with segfaults, or just can't find your way around
the token list representation used by asm.c

NOTE 3:  In assignment 6 you will have to write a
scanner for a different language.  Even if you stick
with asm.c for assignment 4, you might want to have
a look as gvcscan.c for assignment 6.

RATIONALE:  Variable-length memory allocation in C
is much more tedious and error-prone than in languages
like Scheme and Java.  While an assembler really should
not have arbitrary limits on the size of programs, the
point of this course is to learn about the logic of
how to write an assembler, not to work around the
shortcomings of C.  So we have added these restrictions
to the specification, and simplified the implementation
accordingly. 

Gordon Cormack