CSC448: Homework [1/1] |
TASK The task is to extend the compiler to provide parsing, AST, pretty printing, and type-checking. You do not need to worry about getting well-formedness right. We will talk more about it next week. You should support the following constructs. * do-while loops * for loops * switch statements (C-style, with case and default) * 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. 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 I suggest that you code/test incrementally AND take frequent snapshots of your code (perhaps using "ant submit") so that you can revert to an earlier version if a subsequent change does not work out. ======================================================================== 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.