Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribedimage text in transcribed

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 = undefined

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Expert Oracle Database Architecture

Authors: Thomas Kyte, Darl Kuhn

3rd Edition

1430262990, 9781430262992

More Books

Students also viewed these Databases questions

Question

Explain the importance of staffing in business organisations

Answered: 1 week ago

Question

What are the types of forms of communication ?

Answered: 1 week ago

Question

Explain the process of MBO

Answered: 1 week ago