Free variables of a quirk13 expression

Last updated 5 April 1996 to fix include the free variables of the right hand sides of declarations within the free variables of a block.

In my first lecture, I forgot to define the set of free variables for a quirk13 expression. This set is defined by induction on the structure of an expression.

For any expression E that is not a function or block expression, the free variables of E are the union of the free variables of the immediate subexpressions of E. Note that some expressions, such as 13.7 and nil, don't have any immediate subexpressions.

The free variables of

function (T1 X1, ..., Tn Xn) -> T0 E

consist of the free variables of E less the variables X1, ..., Xn.

The free variables of

{ T1 X1 = Y1; ...; Tn Xn = Yn; E1; ...; Em }

consist of the union of the free variables of Y1, ..., Yn, E1, ..., Em less the variables X1, ..., Xn.

I recommend that you implements sets of symbols or variables as an abstract data type, and that you represent sets by lists. If you write representation independent code, you can change the representation of this data type later without affecting the code for your compiler.