[previous] [up] [next]     [index]
Next: Core Scheme Up: Parser Previous: Parser

Preliminaries

zodiac:parsed : zodiac:zodiac (back)

All the output from the parser is an element of zodiac:parsed. Each back contains a distinct box in which information can be stored. All parsed output is either a variable reference, an application, or a special form.

zodiac:form : zodiac:parsed ()

zodiac:app : zodiac:parsed (fun args)

The fun field contains a single zodiac:parsed object, while zodiac:args holds a list of these.

Variables

zodiac:varref : zodiac:parsed (var)

zodiac:top-level-varref : zodiac:varref ()

zodiac:bound-varref : zodiac:varref (binding)

zodiac:lexical-varref : zodiac:bound-varref ()

zodiac:binding : zodiac:parsed (var orig-name)

zodiac:lexical-binding : zodiac:binding ()

All variable references fall under zodiac:varref, whose var field contains the name (Scheme symbol) of the variable (possibly with some consistent renaming performed). The binding field contains a zodiac:binding struct. The var field of a zodiac:binding contains the same zodiac:symbol as in the var field of the referring zodiac:bound-varref. The orig-name field contains the original name, as specified in the input or by a rewrite rule.

zodiac:top-level-varref/bind : zodiac:top-level-varref (slot)

When the procedure scheme-expand-program is used, top-level variable references are given an extra field, slot, which contains a box. All top-level uses (which can be definitions, mutations and uses) of the same name point to the same box. Thus, the box can be used to share information between these instances. Furthermore, this box holds a list of all the references (both definitions and uses) to the identifer. The elements of the list are of zodiac:top-level-varref/binds. Top-level references inside a unit are not related to references to identifiers with the same name outside a unit, i.e., they do not share a box in the slot field. They do, however, share a box amongst themselves, one per unit.

NOTE: The box in the slot field is unrelated to the one possessed by every zodiac:top-level-varref/bind object by virtue of being a sub-type of zodiac:parsed; there is a distinct box of the latter kind for every syntactic occurrence of the top-level variable.

Argument Lists

Regular argument lists are of type zodiac:arglist. These do not allow the specification of a default initial value. When initial values are allowed, the initial value expressions may be evaluated in different environments. The type zodiac:paroptarglist, short for ``parallel optional argument list'' (what is optional is the specification of an initial value expression) expands all the expressions in an environment augmented with all the formal variables, so they can be mutually referential. Another kind, zodiac:optarglist, is available for incremental environment extension from left to right (as in MzScheme's opt-lambda construct).

zodiac:arglist (vars)

zodiac:sym-arglist : zodiac:arglist ()

zodiac:list-arglist : zodiac:arglist ()

zodiac:ilist-arglist : zodiac:arglist ()

vars is always a list of zodiac:lexical-binding. The additional structure indicates whether the argument list is a single zodiac:symbol, a proper list or an improper list. In the first of these cases, vars has length one; in the last of these cases, the period before the last argument is implicit in vars.

zodiac:paroptarglist (vars)

zodiac:sym-paroptarglist : zodiac:paroptarglist ()

zodiac:list-paroptarglist : zodiac:paroptarglist ()

zodiac:ilist-paroptarglist : zodiac:paroptarglist ()

The structure of vars in zodiac:paroptarglist is similar to that in zodiac:arglist. The only exception is that, for expressions where an initial value has been supplied, the element of the list is a pair whose first argument is the zodiac:lexical-binding and whose second argument is in zodiac:parsed.


[previous] [up] [next]     [index]
Next: Core Scheme Up: Parser Previous: Parser

PLT