Lab 7
The idea behind this lab is to develop functions that will be useful in performing random testing on your solutions to Assignment 4 and beyond.
Please note that the word "term" here means the same thing as "expression".
Copy the definition of the AST definition from Assignment 3.
- To allow you to use the random and random-seed functions, import them like this:
(require (typed-in racket [random : (number -> number)] [random-seed : (number -> void)])) Develop the function randomTerm that produces a term containing only functions of one parameter, applications with one argument, and variable references. You’ll need to devise some mechanism that produces trees of a reasonable size
Refine your function randomClosedTerm so that it only produces "closed" CFAEs: that is, those with no free variables. To do this, your function must accept a list of currently-bound variables, so that it can be sure to pick varrefs only from this list.
Use the randomClosedTerm function to test your interpreter. Use printf to display the term before calling interp on it. Can you find a term that loops forever? Can you generate any other errors?