CS712/CS812
Homework 1
Spring 2002
Due Date: Sunday February 3


Add floating point constants and double-precision floating point variables to the Especially Simple C Compiler (escc). The source for escc can be found in ~cs712/public/escc.

If you successfully add both features, you will receive 100% credit. If you only add floating point constants, you will receive 75% credit.

Use the following definition of floating point constants (from "The C Programming Language", first edition, by Kernighan and Ritchie):

A floating constant consists of an integer part, a decimal point, a fraction part, an e or E, and an optionally signed integer exponent. The integer and fraction parts both consist of a sequence of digits. Either the integer part or the fraction part (not both) may be missing; either the decimal point or the e and the exponent (not both) may be missing. Every floating constant is taken to be double-precision.

If you are only adding floating point constants, ignore the last sentence in the above definition and make the type of a floating constant to be single-precision (float).

Double-precision floating point variables should be implemented with the Alpha double-precision data type (t-floating). Escc uses the following rule for assignments: the type of the right is converted to the type of the left. All conversions between numeric types are legal. Use the Alpha instructions 'cvttq', 'cvtts', 'cvtqt', and 'cvtst' for converting between the double type and int type or float type. Other useful instructions will be: 'ldt', 'stt', and 'ldit'. It may be helpful to see what code is generated by cc for sample files: "cc -S file.c" creates "file.s".

The file ~cs712/public/escc/Thw1.c is a test file that your modified escc (at the 100% level) should be able to handle. Other test files will be used when grading your submission so be sure you thoroughly test your work.

You should electronically turn in all source files for your modified escc. You should also turn in a Makefile so I can easily build your modified escc. You should turn in a README file that describes all the files you are turning in. (In other words give me back escc in the same format I gave it to you.)

Your program should be submitted for grading from CIS Alpha machine (e.g. alberti). To turn in this assignment, type:
~cs712/bin/submit hw1 list of files to submit

Do not turn in any non-Ascii files (i.e. no object files, no executable files, etc.).

Submissions can be checked by typing:
~cs712/bin/scheck hw1

To receive full credit for the assignment, you must turn in your files prior to 8am on Monday February 4. Late submissions will be accepted at the penalty of 5% per day up to one week late.

You are expected to do your own work on this assignment.


Last modified on January 22, 2002

Comments and questions should be directed to hatcher@unh.edu