Question: Part 3: A tiny language [Read Chapter 8] Let E (for expression) be a tiny programming language that supports the declaration of arith- metic expressions
![Part 3: A tiny language [Read Chapter 8] Let E (for](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f3b02a8e0c0_37866f3b02a0327b.jpg)

Part 3: A tiny language [Read Chapter 8] Let E (for expression) be a tiny programming language that supports the declaration of arith- metic expressions involving only addition and multiplication, and equality comparisons on integers. Here is an example program in E: When evaluated, this program should evaluate to the truth value true. In this exercise, we will not write E programs as strings, but as values of a Haskell data type E, that can represent E programs as their abstract syntax trees (ASTs). Given the following data type E, data EIntLit Int -- for Int literal, e.g. , (IntLit 3) BoolLit Bool-- for Bool literal, e.g., (BoolLit False) | Plus E E | Mult E E _ for addition _ for multiplication Equals E E deriving (Eq, Show) The above example program is represented as its AST: program = Equals (Plus (IntLit 1) (IntLit 9)) (Mult (IntLit 5) (Plus (IntLit 1) (IntLit 1)))
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
