CSC448: Homework [1/1] |
TASK Extend the compiler to provide full support for the constructs listed below. Full support means: parsing, AST, pretty printing, well-formedness checking, type-checking, AST transformations (and code generation). * do-while loops * for loops * switch statements (C-style, with fall-through, default) (You may reject multiple defaults and identical cases in the same compound statement -- even if they are in different switches.) * continue (works with do, for and while) * break (works with do, for, switch and while) * pre-increment: ++e (e must be int lval, ++e is not an lval) * post-increment: e++ (e must be int lval, e++ is not an lval) * conditional expressions: e1?e2:e3 (e1 must be int, e1?e2:e3 is not an lval) The semantics should be consistent with C, except as noted above for switch. You may want to look at a C reference to ensure that you understand the semantics. For example: http://msdn2.microsoft.com/en-us/library/015az3wz%28VS.80%29.aspx ======================================================================== SUBMISSION The same criteria for grading and submission instructions apply as before. Copy grader.txt into examples/clogs/grader.txt and run "ant submit" in examples/clogs.