ICD4 - Interpreters Flashcards
In the example interpreter for evaluating expressions, in the row labelled id, we have the code: v = lookup(vtable, getname(id)) ; if v = unbound then error() else v. It says getname(id) instead of id, because ANSWER.
id indicates a token with a type and value field
In the example interpreter for evaluating expressions, in the row labelled id, we have the code: v = lookup(vtable, getname(id)) ; if v = unbound then error() else v. The value of v would be unbound in the situation that ANSWER.
getname(id) was not bound
In the ICD textbook’s example interpreter for evaluating expressions, in the row labelled id(Exps), we have the code: args = EvalExps(Exps,vtable,ftable). We pass vtable to EvalExps to handle ANSWER.
expressions that contain identifiers
In the ICD textbook’s example interpreter for evaluating expressions, in the row labelled id(Exps), we have the code: args = EvalExps(Exps,vtable,ftable). We pass ftable to EvalExps to handle ANSWER.
expressions that contain function usages
In the ICD textbook’s example interpreter for evaluating expressions, in the row labelled let id = Exp1 in Exp2, we have the code: v1 = EvalExp(Exp1, vtable, ftable); vtableP = bind(vtable, getname(id), v1), EvalExp(Exp2, vtableP, ftable). The bind function changes vtable into vtableP by ANSWER.
inserting the binding of getname(id) with the value v1 into the table