Due: Thursday, March 29th, 2012 9:10am
As usual...
Start with miniracket5.zip.
Add support for booleans as values and expressions, and also add an iszero form that has a single sub-expression.
Add an if form to the language.
Handin your revised main.c (for new tests), eval.c, print.c, struct.c, struct.h, continue.c, and continue.h.
Here’s an example from recent homework solutions that you might use to test your additions:
symbol* fib = make_symbol("fib"); tagged* fib_var = (tagged*)fib; tagged *fib_func = make_func(n, make_branch(make_iszero(n_var), one, make_branch(make_iszero(make_minus(n_var, one)), one, make_plus(make_app(fib_var, make_minus(n_var, one)), make_app(fib_var, make_minus(n_var, two))))), NULL); hash_table* fib_d = make_dict(); hash_set(fib_d, fib, fib_func); check_num_val(eval(make_app(fib_var, make_num(6)), NULL, fib_d), 13);
Last update: Monday, March 26th, 2012mflatt@cs.utah.edu |