3 ms·
The first part defines the "type" of Expr. An Expr can be an int, a variable string, or an Add, Mul of two Exprs. The next bit takes an environment (env) and an
by unignorant 15y ago
The first part defines the "type" of Expr. An Expr can be an int, a variable string, or an Add, Mul of two Exprs. The next bit takes an environment (env) and an Expr (exp) and recursively evaluates sub-Exprs of the Expr. Then an environment is defined, mapping variables to underlying values. Then an expression is defined. Finally, the expression is evaluated in the environment.