Computer Science & Electrical Engineering

Compiler Construction – SMD163



Homework assignment 1

  1. Compile and run the quick calculator program (QuickCalc.java). You can also rewrite it
    in a language of your own choice if you wish …

  2. Extend the data structures with a representation for unary minus

  3. Add methods to construct and evaluate the new forms of expression (you can ignore the
    compile method; just use {} for the body)

  4. Modify the parser, giving unary minus a higher precedence than any other operator (for
    example, -2+3, -(2+3), 4 * -5, and - - 23 should give 1, -5, -20, and 23, respectively)

Report via email to .  Subject line: SMD163 - 1.  Deadline is Jan 23, 10:00.




Homework assignments are carried out individually.

Oral discussion is good, copying files is not
!