Question
Define the abstract syntax of MiniLogo commands by defining a new Haskell data type Cmd. I have provided several more types and type synonyms that
-
Define the abstract syntax of MiniLogo commands by defining a new Haskell data type Cmd. I have provided several more types and type synonyms that you should use in these definitions. Note that you do not need to define a separate synonym for cmds since cmds and block are equivalent in the abstract syntax, and cmds only appears in the grammar as part of block.
-
Define the undefined ASTs of type Block corresponding to the bodies of the two macros in the final example from the language description (the program containing the for loop).
The doctests show the concrete syntax of these blocks, but you wont be able to pass the doctests until completing the next task.
-
Define a pretty printer for MiniLogo commands by implementing the function prettyCmd. As before, you should try to make your output match the concte syntax used in the doctests and on the language description page exactly. You may want to add your own doctests while developing prettyCmd. I omitted my doctests from the template since your constructor names will likely be different from mine. The doctests from the previous tasks will serve to evaluate your pretty printer, but it might be helpful to have smaller test cases too.
Step 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