LangProc / langproc-2021-lab

2 stars 4 forks source link

TODO-B: Variable Binding #84

Closed ptar124 closed 2 years ago

ptar124 commented 2 years ago

In ast_primitives.hpp, there is a todo comment that says this:

// TODO-B : Run bin/eval_expr with a variable binding to make sure you understand how this works.
 // If the binding does not exist, this will throw an error

what is meant by "run with a variable binding"?

petraratkai commented 2 years ago

What you're meant to do is basically something like this: Assume we have the expression x+6, and want to evaluate it when x is 7. The usage is:

$ make bin/eval_expr $ bin/eval_expr x 7 x+6 13.000000

so you just make bin/eval_expr and run it with a variable binding, which in this case is the 'x 7' part that tells the program that variable x has value 7