Marist-CMPT331-TOPL / adder

Adder is a small but usable subset of the Python language. It is named for the Blackadder comedy series, much as the Python language is named for Monty Python.
MIT License
0 stars 2 forks source link

Interpreter support for unary operations #42

Open Tientuine opened 1 year ago

Tientuine commented 1 year ago

@Marist-CMPT331-TOPL/students

The interpreter should be able to handle unary operations by implementing the corresponding semantic rule(s) to compute an Answer.

  1. [ ] Declare a helper function called valueOfUop that takes a UnaryOp and two expressed values and returns an appropriate expressed value. Initially leave this function undefined, so that the operator cases themselves may be implemented by someone else.
  2. [ ] Add a case to valueOf for UnaryExpr that relies on the helper valueOfUop function. This implementation should compute the values of the operand expression, accounting for state changes appropriately, and then pass the value into the helper function.