Using the techniques presented in class (and in the posted notes), manually compile this program over family trees. Turn in at least three separate, self-contained files:
If you don't get the final version working, you may also turn in the last working version you had. Please don't turn in every version you wrote -- I do need to read all of these!
NOTE: I expect that you have actually run and tested the programs you submit for this assignment. I won't grade files that you clearly have not run and tested (for example, a program with syntax errors clearly hasn't been run). Obviously, if you dind't get the final compiler fully working, turn in what you have, but what you have should at least run in Scheme, even if it doesn't produce the correct answer.
Some hints and guidelines:
have-eye-color
, etc).
have-eye-color
and
eye-match?
.
init-ftree
that takes in an ftree and
initializes the heap with that ftree (returning the address of the
tree in the heap).
extract-list
that takes a heap address
that contains a list and returns the corresponding Scheme list. You
may assume the list contains atomic data (nums/syms/bools).
The given family tree program fixes the function with which we will filter the tree. Compile a version that takes in a tree, a predicate on people, and a function on people and returns a list. The list contains the result of running the function (3rd arg) on each person who satisfied the predicate (2nd arg). This version lets you experiment with compiling functions as arguments.
(This one would take you a while) For a more substantial challenge, implement the compiler (or at least the first couple of stages). Pick one of our languages (with at least basic arithmetic, vars and let statements) and write a program that compiles programs in that language. You'll need to define a datatype for the language you are compiling into.