ICD4 - Interpreters Flashcards

1
Q

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.

A

id indicates a token with a type and value field

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

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.

A

getname(id) was not bound

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

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.

A

expressions that contain identifiers

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

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.

A

expressions that contain function usages

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

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.

A

inserting the binding of getname(id) with the value v1 into the table

How well did you know this?
1
Not at all
2
3
4
5
Perfectly