CPSC 371: First Compilation Assignment This week you are asked to write a compiler for SIMPLE Tiger expressions. You do not have to worry about variables and scope (no let statements). You do not have to worry about records or arrays - only simple integers and strings constants. You do not have to compile function declarations. However, you should hand-code the Tiger library function "print" in assembly, and be able to generate code that will call it when encountered. When compiling the function-call abstract syntax class ("CallExp"), you may assume that the function will not take more than 6 arguments (so you can store the arguments in registers o0-o7). Also remember that the name of the function in the syntax tree is a "Symbol". To get the String representation of Symbol s, use "s.toString()", which Appel defined in his Symbol class (at least that works!). So, basically your program should generate code for something like: ( 3; 3+4*(9-4); /* optionally, define a "printint function" to test it. */ print("hi"); if 3 then 4 else 5; if 4 then print("4 is true"); while (3 & 4) do print("3 and 4 are both true") ) That is, only expressions that do not contain variables, records, arrays, scopes, and only expressions that calls predefined (hand-coded) functions. If you have time, implement the symbol-table so we can have variables. The assembly you generate must include comments so I can see what's happening. (Now you've gotten to a stage in your education where not only your code will include comments, but the code generated by your code will also include comments. Mark it as a milestone!) DEMONSTRATE YOUR PROGRAM. ------------------------------------------------------------ Lastly, here's the syntax tree of the above Tiger sequence as printed by *my* parser: SeqExp( ExpList( IntExp(3), ExpList( OpExp( PLUS, IntExp(3), OpExp( MUL, IntExp(4), SeqExp( ExpList( OpExp( MINUS, IntExp(9), IntExp(4)))))), ExpList( CallExp(print, ExpList( StringExp("hi"))), ExpList( IfExp( IntExp(3), IntExp(4), IntExp(5)), ExpList( IfExp( IntExp(4), CallExp(print, ExpList( StringExp("4 is true")))), ExpList( WhileExp( SeqExp( ExpList( OpExp( AND, IntExp(3), IntExp(4)))), CallExp(print, ExpList( StringExp("3 and 4 are both true")))) )))))))