Waiting for answer This question has not been answered yet. You can hire a professional tutor to get the answer.

QUESTION

Problem 1 Define an abstract syntax of the while language suitable for interpretation in either Haskell or Prolog. In Haskell, the definition should...

Problem 1Define an abstract syntax of the while language suitable for interpretation in either Haskell or Prolog. In Haskell, the definition should be the code of a few data types. In Prolog, no code may be necessary. In this is your case, move directly to Problem 2.Problem 2Code two simple while programs in the syntax of Problem 1. One program is the factorial shown above, the other is a program of your choice.Problem 3Code an interpreter of the while language in either Haskell or Prolog. Your interpreter should have a function (in Haskell) or a predicate (in Prolog) that takes the abstract syntax tree of a program of Problem 2 as one of its argument. The interpreter should execute the program statements and produce (return in Haskell or bind in Prolog or print, if you prefer) the value of the program variables at the end of the execution. The structure or format of these values is irrelevant as long as it is understandable, see below. You are free to implement only the portions of the interpreter that are needed for the execution of the two programs of Problem 2.

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question