Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Define the abstract syntax of MiniLogo expressions by defining the Haskell data type Expr. You should not include the grouping production in your abstract syntax
Define the abstract syntax of MiniLogo expressions by defining the Haskell data type Expr. You should not include the grouping production in your abstract syntax since it is not needed (see the language description). I have provided the type synonym for variable names. You can use the built-in type Int for the int syntactic category directly.
module HW3 where import Data.List (intercalate) Part 1: Expressions Syntax | Variable names. type Var = String | Expressions. data Expr ExprTODO -- This is a dummy constructor that should be removed! deriving (Eq, Show) | 2 + 3 * x expr1 :: Expr expr1 = undefined -- | 2 + 3 * x + 4 expr2 :: Expr expr2 = undefined | (x + 2) * 3 * y expr3 :: Expr expr3 = undefined -- | (x + 2) * (y + 3) expr4 :: Expr expr4 = undefined module HW3 where import Data.List (intercalate) Part 1: Expressions Syntax | Variable names. type Var = String | Expressions. data Expr ExprTODO -- This is a dummy constructor that should be removed! deriving (Eq, Show) | 2 + 3 * x expr1 :: Expr expr1 = undefined -- | 2 + 3 * x + 4 expr2 :: Expr expr2 = undefined | (x + 2) * 3 * y expr3 :: Expr expr3 = undefined -- | (x + 2) * (y + 3) expr4 :: Expr expr4 = undefinedStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started