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.
The interpreter should be able to handle unary operations by implementing the corresponding semantic rule(s) to compute an Answer.
[ ] 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.
[ ] 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.
@Marist-CMPT331-TOPL/students
The interpreter should be able to handle unary operations by implementing the corresponding semantic rule(s) to compute an
Answer
.valueOfUop
that takes aUnaryOp
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.valueOf
forUnaryExpr
that relies on the helpervalueOfUop
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.