We extend the language from Sect. 4.2 with boolean operators. We add the following productions to Grammar 4.1: Exp → not Exp Exp → Exp and Exp When evaluating not e, we first evaluate e to a value v...



We extend the language from Sect. 4.2 with boolean operators. We


add the following productions to Grammar 4.1:


Exp → not Exp


Exp → Exp and Exp


When evaluating not e, we first evaluate e to a value v that is checked to be a


boolean. If it is, we return ¬ v, where ¬ is logical negation.


When evaluating e1 and e2, we first evaluate e1 and e2 to values v1 and v2 that


are both checked to be booleans. If they are, we return v1 ∧ v2, where ∧ is logical


conjunction.


Extend the interpretation function in Fig. 4.2 to handle these new constructions


as described above.



May 26, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here