Question: Problem1 (a) Using the SML system to define a datatype for labeled 3-branch trees, the trees with possible zero, one, two, or three branches. Label

 Problem1 (a) Using the SML system to define a datatype for

Problem1 (a) Using the SML system to define a datatype for labeled 3-branch trees, the trees with possible zero, one, two, or three branches. Label the nodes of the trees by integers. No polymorphic definition for this problem. (b) Draw a concrete 3-branch tree of at least 12 nodes but no more than 15 nodes, and the integers labeling the nodes range from 20 to 40. Represent this tree by using your 3-branch tree datatype definition. Your representation has to be accepted by SML as an instance of the datatype 3-branch trees you define. (c) Using the SML system to define a function in SML that sums of the squares of all integer (d) Apply this function to your concrete tree to get the correct result. Problem 2 (a) Using SML to define datatypes for the syntax (abstract syntax) of the following small and nodes of any integer 3-branch trees. simplified expression language defined in BNF, and submit a hardcopy of your SML definition. (Hint: Since are constants or terminals, they do not have to show up in your datatype definitions. Non-terminal "expression" and "term" indicate whether the structure is for addition or for multiplication.) expression>- I + ::= | * al ble d elflglhij (b) Similar to what you did for problem 1 (b), represent expression"g+ fe+e*b*a" by using (c) Using the SML system to define functions in SML that count the number of all identifies (d) Apply your top function to the expression given in (b) represented in the datatype you define your datatype definitions for problem 2(a). Your representation has to be accepted by SML as an instance expression of your datatype definition for the language. appearing in any ex pression. for the language

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!