Download Editing Graphical Objects Using Procedural
Transcript
55 Figure 5-1: The structure of the Dee editor a subroutine contains a pointer to a routine descriptor that in turn contains a local symbol table for the routine, stored as a sorted binary tree. The local symbol table contains the type and the stack offset for each variable; if the current routine is an object that is a variant of another object the variables all have offsets larger than those in the original object. Dum's syntax guarantees that the first element of any list in the program is a keyword or routine name, so the parser looks for these in the global symbol table. If the lookup fails, the name is assumed to be an as yet undefmed routine. Any other names in the list are local variables, so the parser looks them up in the local symbol table; if this fails and the current routine is a variant object the parser looks in the symbol table for the original. The only exception to this is the control point name argument to the getpoint operator, (getpoint <object> <pointnarne». Since the type of the object is not known at compile time, the control point name cannot be looked up until runtime. In addition to the local symbol table, the routine descriptor contains these fields: The return type of the routine. The number and types of the arguments. A list of pointers to the arguments in the local symbol table. A list of pointers to the control points in the global symbol table. Parent, child, and next pointers for the object variation hierarchy. A pointer to the definition of the routine in the parse tree. A pointer to a list of invocations in the execution tree.