11.07.2015 Views

Advanced Programming Guide

Advanced Programming Guide

Advanced Programming Guide

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

A.2 Internal Representations of Data Types • 359The local-seq points to an expression sequence listing the explicitlyand implicitly declared local variables. Each entry is a NAME. The explicitlydeclared variables appear first. Within the procedure, locals are referredto by LOCAL structures, the local variable number being the index intothe local-seq.The option-seq field points to an expression sequence of options tothe procedure (for procedures, options are the same thing as attributes).Each entry is a NAME or EQUATION specifying an option. Typical optionsare remember, operator, and ‘Copyright ...‘.The rem-table field points to a hash table containing rememberedvalues of the procedure. Entries in the table are indexed by the procedurearguments, and contain the resulting value. If there is no remember table,this field contains a pointer to NULL, the empty expression sequence.The stat-seq field points to a single statement or a statement sequence(STATSEQ). If the procedure has an empty body, this is a pointer to NULLinstead. For each procedure that is built into the kernel, there is a wrapperPROC that has the option builtin in its option-seq, and a single Mapleinteger pointed to by its stat-seq. The integer gives the built-in functionnumber.The desc-seq field points to an expression sequence of NAMEs orSTRINGs. These are meant to provide a brief description of what the proceduredoes, and are displayed even when interface(verboseproc) isless than 2.The global-seq field points to a list of the explicitly declared globalvariables in the procedure (those that appeared in the global statement).This information is never used at run time, but it is used when simplifyingnested procedures to determine the binding of lexically scoped identifiers.For example, an identifier on the left side of an assignment in a nestedprocedure can be global if it appears in the global statement of a surroundingprocedure. This information is also used at procedure printingtime, so that the global statement will contain exactly the same globalidentifiers that were declared in the first place.The lexical-seq field points to an expression sequence of links to identifiersin the surrounding scope, if any. The sequence consists of pairs ofpointers. The first pointer of each pair is to the globally unique NAME ofthe identifier; this is needed at simplification and printing time. The secondpointer is a pointer to a LOCAL, PARAM, or LEXICAL structure which isunderstood to be relative to the surrounding scope. When a procedure isevaluated (not necessarily called), the lexical-seq is updated by replacingeach of the second pointers with a pointer to the actual object represented.The name pointers are not touched, so that the actual identifier

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!