Assignment 7: Adding new data types
Due: Fri 03/11 at 9:00pm
1 Problem description
Suppose we want to add support to Egg-eater for double-precision (64-bit) floating point numbers. Describe what phases of the compiler might be impacted, and describe the changes needed.
Suppose we implemented the above correctly. Now suppose we wanted to also add support for complex numbers, whose components could each be either ints or doubles, and that obey the standard rules of complex arithmetic. Describe what else in your compiler might need to change.
Answer question 1 first, then answer question 2.
Your answers to each question should address all the phases of compilation: if you think a phase is irrelevant to these changes, explain why; if you think the change is trivial, explain it concisely. You should work through the full compiler design recipe, giving concrete syntax, examples, semantics, and descriptions of implementation and interesting test cases. (You do not have to explain how to change the lexer to support floating-point or complex-number literal notation, or how to update the parser to support the grammar updates you describe, and can assume that those two are given to you. You should explain what changes are needed in your abstract syntax, and work from there.)
Your response should be only a few pages long (i.e. I’m not expecting a
lengthy writeup, but you should still express yourself as clearly as
necessary), and should be written in clear, grammatical English, with
pseudocode if you choose. Submit either a plain text file, a Markdown file, a
Word document, or a PDF —
2 Submission
Wait! Please read the assignment again and verify that you have not forgotten anything!
Please submit your homework to https://handins.ccs.neu.edu/ by the above deadline.