TrikkStar/ProgLangAssignments

Implement comparison operators

Closed this issue · 0 comments

  • Add a new exprC type variant CompC that takes a string and two exprCs.
  • Create a helper method compEval with type string -> value -> value -> value that takes as input a string and two values. If the two values are not both Nums then it should raise an interpreter error. If they are, then it should perform the appropriate operator and return a Bool value. It should be an interpreter error if the operator is not one of the four mentioned above.
  • Add a new case in interp to handle the CompC construct, by evaluating the two expressions in the correct order then passing the work over to compEval.
  • Add tests for the comparison semantics.
  • Add a new exprS type variant CompS analogous to CompC, and the corresponding clause in desugar to convert it into CompC.
  • Add tests for the desugaring.