Contents Previous Next Index

Internal Representation


The table below lists the structures that are currently implemented in Maple.
Each structure, along with the constraints on its length and contents, is described in the sections that follow.
Table appendix1.1: Maple Structures 
AND

ASSIGN

BINARY

BREAK

CATENATE

COMPLEX

CONTROL

DCOLON

DEBUG

EQUATION

ERROR

EXPSEQ

FLOAT

FOR

FOREIGN

FUNCTION

GARBAGE

HASH

HASHTAB

HFLOAT

IF

IMPLIES

INEQUAT

INTNEG

INTPOS

LESSEQ

LESSTHAN

LEXICAL

LIST

LOCAL

MEMBER

MODDEF

MODULE

NAME

NEXT

NOT

OR

PARAM

POLY

POWER

PROC

PROD

RANGE

RATIONAL

READ

RETURN

RTABLE

SAVE

SDPOLY

SERIES

SET

STATSEQ

STOP

STRING

SUM

TABLE

TABLEREF

TRY

UNEVAL

USE

XOR

ZPPOLY






Internal Functions


The internal functions in Maple are divided into five groups:

Evaluators


The evaluators are the main functions responsible for evaluation. There are six types of evaluations: statements, algebraic expressions, Boolean expressions, name forming, arbitrary precision floatingpoint arithmetic, and hardware floatingpoint arithmetic. The user interface calls only the statement evaluator, but thereafter there are many interactions between evaluators. For example, the statement
if a > 0 then bi := 3.14/a end if;



is first analyzed by the statement evaluator, which calls the Boolean evaluator to resolve the if condition. Once completed (for example, a true result is returned), the statement evaluator is invoked again to perform the assignment, for which the nameforming evaluator is invoked with the lefthand side of the assignment, and the expression evaluator with the righthand side. Since the righthand side involves floatingpoint values, the expression evaluator calls the arbitrary precision floatingpoint evaluator.
Normally, you do not specifically call any of the evaluators. However, in some circumstances, when a nondefault type of evaluation is needed, you can directly call evalb (the Boolean evaluator), evaln (the nameforming evaluator), evalf (the arbitrary precision floatingpoint evaluator), or evalhf (the hardware floatingpoint evaluator).


Algebraic Functions


Algebraic functions are commonly called basic functions. Some examples are taking derivatives (diff), dividing polynomials (divide), finding coefficients of polynomials (coeff), computing series (series), mapping a function (map), expanding expressions (expand), and finding indeterminates (indets).


Algebraic Service Functions


These functions are algebraic in nature, but serve as subordinates of the functions in the previous group. In most cases, these functions cannot be explicitly called. Examples of such functions are the internal arithmetic packages, the basic simplifier, and retrieval of library functions.


Data Structure Manipulation Functions


These are similar to the algebraic functions, but instead of working on mathematical objects, such as polynomials or sets, they work on data structures, such as expression sequences, sums, products, or lists. Examples of such functions are operand selection (op), operand substitution (subsop), searching (has), and length determination (length).


General Service Functions


Functions in this group are at the lowest hierarchical level. That is, they can be called by any other function in the system. They are general purpose functions, and not necessarily specific to symbolic or numeric computation. Some examples are storage allocation and garbage collection, table manipulation, internal I/O, and exception handling.



Flow of Control


The flow of control does not need to remain internal to the Maple kernel. In many cases, where appropriate, a decision is made to call functions that are written in Maple and are a part of the Maple library. For example, many uses of the expand function are handled in the kernel. However, if an expansion of a sum to a large power is required, the internal expand function calls the external Maple library function 'expand/bigpow' to resolve it. Functions such as diff, evalf, series, and type make extensive use of this feature.
Therefore, for example, the basic function diff cannot differentiate any function. All of that functionality is included in the Maple library in procedures named 'diff/functionName'. This is a fundamental feature of Maple since it permits:
•

Flexibility (the ability to change the Maple library)

•

Customization (by defining your refined handling functions)

•

Readability (much of the Maple functionality is visible at the user level)

Maple allows the kernel to remain small by offloading nonessential functions to the library.


Internal Representations of Data Types


The parser and some internal functions build all of the data structures used internally by Maple. All of the internal data structures have the same general format:
Header


...




The header field, stored in one or more machine words, encodes the length of the structure and its type. Additional bits are used to record simplification status, garbage collection information, persistent store status, and various information about specific data structures (for example, whether a for loop contains a break or next statement).
The length is encoded in 26 bits on 32bit architectures, resulting in a maximum single object size of 67,108,863 words (268,435,452 bytes, or 256 megabytes). On 64bit architectures, the length is stored in 32 bits, for a maximum object size of 4,294,967,295 words (34,359,738,360 bytes or 32 gigabytes).
Every structure is created with its own length, and that length does not change during the existence of the structure. Furthermore, the contents of most (but not all) data structures are never changed during execution because it is unpredictable how many other data structures are referring to them and relying on them not to change. The normal process for modifying a structure is to copy it and then to modify the copy. Structures that are no longer used are eventually reclaimed by the garbage collector.
The following sections describe each of the structures currently implemented in Maple, along with the constraints on their lengths and contents. The 6bit numeric value identifying the type of structure is of little interest, so symbolic names will be used.
The notation ^something in the data structure depictions indicates that the value stored in that field of the structure is a pointer to the value (something), rather than being the something itself.

AND: Logical AND


Maple syntax: expr1 and expr2
Length: 3


ASSIGN: Assignment Statement


ASSIGN

^nameseq

^exprseq



Maple syntax: name1, name2, ... := expr1, expr2, ...
Length: 3
The lefthand side name entries must evaluate to assignable objects: NAME, FUNCTION, MEMBER or TABLEREF structures, or a sequence thereof. If the lefthand side is a sequence, the righthand side must be a sequence of the same length.


BINARY: Binary Object


Maple syntax: none
Length: arbitrary
The BINARY structure can hold any arbitrary data. It is not used directly as a Maple object, but is used as storage for large blocks of data within other Maple objects (currently only RTABLE structures). It is also sometimes used as temporary storage space during various kernel operations.


BREAK: Break Statement


Maple syntax: break
Length: 1


CATENATE: Name Concatenation


Maple syntax: name  expr
Length: 3
•

If the name entry is one of NAME, CATENATE, LOCAL, or PARAM, and if the expr entry evaluates to an integer, NAME, or STRING, the result is a NAME.

•

If the name entry is a STRING or CATENATE that resolves to a STRING, and if the expr entry evaluates to an integer, NAME, or STRING, the result is a STRING.

•

If expr is a RANGE, the result is to generate an EXPSEQ of the NAME or STRING structures.



COMPLEX: Complex Value


Maple syntax: Complex(re,im), Complex(im), re + im * I or im * I
Length: 2 or 3
The re and im fields must point to INTPOS, INTNEG, RATIONAL, or FLOAT structures, one of the NAMEs infinity or undefined, or a SUM structure representing infinity. In the length 3 case, if either re or im is a FLOAT, the other must be a FLOAT as well.


CONTROL: Communications Control Structure


Maple syntax: none
Length: 2
This is an internal structure used for communication between the kernel and user interface. Such a structure never reaches the user level, or even the mathematical parts of the kernel.


DCOLON: Type Specification or Test


Maple syntax: expr :: typeExpr
Length: 3
This structure has three interpretations depending on the context in which it is used. When it appears in the header of a procedure definition, it is a parameter declaration that has a type. When it appears in the local section of a procedure or on the lefthand side of an assignment, it is a type assertion. When it appears elsewhere (specifically, in a conditional expression), it is a type test.


DEBUG: Debug


Maple syntax: none
Length: 2 or more
This is another structure that is only used internally. It is used by the kernel when printing error traceback information to transmit that information up the call stack.


EQUATION: Equation or Test for Equality


Maple syntax: expr1 = expr2
Length: 3
This structure has two interpretations depending on the context in which it is used. It can be either a test for equality, or a statement of equality (not to be confused with an assignment).


ERROR: Error Statement


Maple syntax: error "msg", arg, ... arg
Length: 2
This structure represents the Maple error statement. The expr is either a single expression (if only a message is specified in the error statement), or an expression sequence (if arguments are also specified). The actual internal tag used for the ERROR structure is MERROR to prevent a conflict with a macro defined by some C compilers.


EXPSEQ: Expression Sequence


Maple syntax: expr1, expr2, ...
Length: 1 or more
An expression sequence is an ordered sequence of expressions. It is most commonly used to construct lists, sets, and function calls. Extracting an expression sequence from a list or set L can be done by using the command op(L). This operation is very efficient as it does not involve creation of a new structure. Similarly, if E is an expression sequence, then constructing a list using [E] involves almost no work and is also very efficient. Constructing a set using {E} requires E to be sorted. A function call data structure is made up of the function name plus the expression sequence of arguments. During evaluation of a function call, the argument sequence gets flattened into one expression sequence. That is, f(E1,E2) is turned into f(e11,e12,...e1n,e21,e22,...e2m) where e1i constitutes the members of the expression sequence E1, and e2i constitutes the members of the expression sequence E2. Thus it is not possible to pass raw expression sequences as arguments to functions. Typically sequences are wrapped in lists, as f([E1],[E2]) in order to keep the element groupings intact. The special value NULL is represented by an empty expression sequence. Thus, [NULL] is equivalent to [], and f(NULL) is equivalent to f().


FLOAT: Software FloatingPoint Number


FLOAT

^integer1

^integer2

^attribexpr



Maple syntax: 1.2, 1.2e3, Float(12,34), Float(infinity)
Length: 2 (or 3 with attributes)
A floatingpoint number is interpreted as integer1 * 10^integer2. A floatingpoint number can optionally have attributes, in which case, the length of the structure is 3 and the third word points to a Maple expression. This means that several floatingpoint numbers with the same value but different attributes can exist simultaneously.
The integer2 field can optionally be one of the names, undefined or infinity, in which case the FLOAT structure represents an undefined floatingpoint value (notanumber, or NaN, in IEEE terminology), or a floatingpoint infinity. When integer2 is undefined, integer1 can accept different small integer values, allowing different NaN values to exist. When integer2 is infinity, integer1 must be 1 or 1.


FOR: For/While Loop Statement


FOR

^name

^fromexpr

^byexpr

^toexpr

^condexpr

^statseq



FOR

^name

^inexpr

^condexpr

^statseq



Maple syntax:
for name from fromExpr by byExpr to toExpr
while condExpr do
statSeq
end do



Maple syntax:
for name in inExpr
while condExpr do
statSeq
end do



Length: 7 or 5
The name follows the same rules as the name field of the ASSIGN structure, except that it can also be the empty expression sequence (NULL), indicating that there is no controlling variable for the loop.
The fromexpr, byexpr, toexpr, and condexpr entries are general expressions. All are optional in the syntax of for loops and can therefore be replaced with default values (1, 1, NULL, and true respectively) by the parser.
The statseq entry can be a single Maple statement or expression, a STATSEQ structure, or NULL indicating an empty loop body. An additional bit in the header of the FOR structure is used to indicate whether the statseq entry contains any break or next statements.


FOREIGN: Foreign Data


Maple syntax: none
Length: 1 or more
This structure is similar to the BINARY structure, except that it is for use by Maple components outside the kernel, such as the user interface. A FOREIGN structure is exempt from garbage collection, and the external component is responsible for freeing this structure when it is finished using it.
FOREIGN data structures can be created and managed in external code by using the MaplePointer API functions. For more information, refer to the OpenMaple,C,MaplePointer help page.


FUNCTION: Function Call


FUNCTION

^name

^exprseq

^attribexpr



Maple syntax: name( exprSeq )
Length: 2 (or 3 with attributes)
This structure represents a function invocation (as distinct from a procedure definition that is represented by the PROC structure). The name entry follows the same rules as in ASSIGN, or it can be a PROC structure. The exprseq entry gives the list of actual parameters; this entry is always an expression sequence (possibly of length 1, which indicates that no parameters are present).


GARBAGE: Garbage


Maple syntax: none
Length: 1 or more
This structure is used internally by the Maple garbage collector as a temporary object type for free space.


HFLOAT: Hardware Float


HFLOAT

floatword

floatword



Maple syntax: none
Length: 2 on 64bit architectures; 3 on 32bit architectures
This structure is used to store a hardware floatingpoint value. The one or two words (always 8 bytes) after the header store the actual doubleprecision floatingpoint value. HFLOAT objects can appear as the result of floatingpoint computations, I/O operations, or by extracting elements from hardware floatingpoint RTABLE structures. They look like and are treated as indistinguishable from software FLOAT objects.


IF: If Statement


IF

^condexpr1

^statseq1

^condexpr2

^statseq2

...

...

^statseqN



Maple syntax:
if condExpr1 then
statSeq1
elif condExpr2 then
statSeq2
...
else statSeqN
end if



Length: 3 or more
This structure represents the if ... then ... elif ... else ... end if statements in Maple. If the length is even, the last entry is the body of an else clause. The remaining entries are interpreted in pairs, where each pair is a condition of the if or elif clause, followed by the associated body.


IMPLIES: Logical IMPLIES


Maple syntax: expr1 implies expr2
Length: 3


INEQUAT: Not Equal or Test for Inequality


Maple syntax: expr1 < > expr2
Length: 3
This structure has two interpretations, depending on the context in which it is used. It can be either a test for inequality or an inequality statement.


INTNEG: Negative Integer


Maple syntax: 123
Length: 2 or more
This data structure represents a negative integer of arbitrary precision. For a complete description of the integer representation, including positive integers, see the following section.


INTPOS: Positive Integer


Maple syntax: 123
Length: 2 or more
This data structure represents a positive integer of arbitrary precision. Integers are represented internally in a base equal to the full word size of the host machine. On 32bit architectures, this base is . On 64bit architectures, the base is 2^64. Integers in this range use the GNU Multiple Precision Arithmetic (GMP) library for integer arithmetic.
Small integers are not represented by data structures. Instead of a pointer to an INTPOS or INTNEG structure, a small integer is represented by the bits of what would normally be a pointer. The least significant bit is 1, which makes the value an invalid pointer (since pointers must be wordaligned). Such an integer is called an immediate integer.
The range of integers that can be represented in this way is 1,073,741,823 to 1,073,741,823 (that is, about +10^9) on 32bit architectures, and 4,611,686,018,427,387,903 to 4,611,686,018,427,387,903 (that is, about +410^18) on 64bit architectures. (Note that the maximum (nonimmediate) integer magnitude in Maple is about 2^2,147,483,488 on 32bit architectures and 2^274,877,906,688 on 64bit architectures.)


LESSEQ: Less Than or Equal


Maple syntax: expr1 <= expr2, expr2 >= expr1
Length: 3
This structure has two interpretations, depending on the context. It can be interpreted as a relation (that is, an inequation) or as a comparison (for example, in the condition of an if statement, or the argument to a call to evalb). Maple does not have a greaterthanorequal structure. Any input of that form is stored as a LESSEQ structure.


LESSTHAN: Less Than


Maple syntax: expr1 < expr2, expr2 > expr1
Length: 3
Similar to the LESSEQ structure above, this structure has two interpretations, depending on the context. It can be interpreted as a relation (that is, an inequation), or as a comparison (for example, in the condition of an if statement, or the argument to a call to evalb).
Maple does not have a greaterthan structure. Any input of that form is stored as a LESS structure.


LEXICAL: Lexically Scoped Variable within an Expression


Maple syntax: name
Length: 2
This represents an identifier within an expression in a procedure or module that is not local to that procedure, but is instead declared in a surrounding procedure or module scope. The integer field identifies which lexically scoped variable of the current procedure is being referred to. The integer, multiplied by 2, is an index into the lexicalseq structure referred to by the PROC DAG of the procedure. Specifically, integer * 2  1 is the index to the NAME of the identifier, and integer * 2 is the index to a description (LOCAL, PARAM, or LEXICAL) relative to the surrounding scope. The value of integer can be positive or negative. If integer is a positive value, the original identifier is a local variable of a surrounding procedure; if integer is a negative value, it is a parameter of a surrounding procedure.


LIST: List


LIST

^exprseq

^attribexpr



Maple syntax: [ expr, expr, ... ]
Length: 2 (or 3 with attributes)
The elements of the exprseq are the elements of the list. The list can optionally have attributes.


LOCAL: Local Variable within an Expression


Maple syntax: name
Length: 2
This structure indicates a local variable when it appears within an expression in a procedure or module. The integer is an index into the procedure localseq. At procedure execution time, it is also an index into the internal data structure storing the active locals on the procedure activation stack, and stores private copies of the NAMEs of the local variables (private copies in the sense that these NAMEs are not the same as the global NAMEs of the same name).


MEMBER: Module Member


Maple syntax: module:name
Length: 3
This structure represents a module member access in an expression. MEMBER objects typically do not persist when a statement is simplified. Instead, they are replaced by the actual member that they refer to (an instance of a NAME).


MODDEF: Module Definition


MODDEF

paramseq

localseq

optionseq

exportseq

statseq

descseq



globalseq

lexicalseq

modseq

static localseq

static exportseq

static nameseq



Maple syntax:
module modName ( )
description d1, d2, ...;
local l1, l2, ...;
local sl1::static, sl2::static, ...;
export e1, e2, ...;
export se1::static, se2::static, ...;
global g1, g2, ...;
option o1, o2, ...;
statSeq
end module



Length: 13
The parameter sequence (paramseq), which occurs between the parentheses after modName, points to an expression sequence describing the formal parameters of the module. Currently, Maple does not support parameterized modules, so this field always points to the sequence containing only an instance of the name thismodule.
The local sequence (localseq) points to an expression sequence listing the explicitly and implicitly declared local variables. Each entry is a NAME. The explicitly declared variables appear first. Within the module, locals are referred to by LOCAL structures, the local variable number being the index into the local sequence. The instances of these names appear in the MODULE structure.
The export sequence (exportseq) points to an expression sequence listing the exported module members. Each entry is a NAME. Within the module, exports are referred to by LOCAL structures, the local variable number being the number of elements in the local sequence, plus the index into the export sequence. The instances of these names appear in the MODULE structure.
The option sequence (optionseq) points to an expression sequence of options to the module (for modules, options are the same as attributes). Each entry is a NAME or EQUATION specifying an option. Typical options are package, load=... and unload=...
The statement sequence (statseq) field points to a single statement or a statement sequence (STATSEQ). If the module has an empty body, this is a pointer to NULL instead.
The description sequence (descseq) field points to an expression sequence of NAMEs or STRINGs. These sequences are meant to provide a brief description of what the module does and are displayed even when the value of interface(verboseproc) is less than 2.
The global sequence (globalseq) field points to a list of the explicitly declared global variables in the module (those that appeared in the global statement). This information is never used at run time, but is used when simplifying nested modules and procedures to determine the binding of lexically scoped identifiers (for example, an identifier on the lefthand side of an assignment in a nested procedure can be global if it appears in the global statement of a surrounding context). This information is also used at printing time, so that the global statement contains exactly the global identifiers that were declared originally.
The lexical sequence (lexicalseq) field points to an expression sequence of links to identifiers in the surrounding scope, if any. The sequence consists of pairs of pointers. The first pointer of each pair is to the globally unique NAME of the identifier; this is needed at simplification and printing time. The second pointer is a pointer to a LOCAL, PARAM, or LEXICAL structure which is understood to be relative to the surrounding scope. When a module definition is evaluated, the lexical sequence is updated by replacing each of the second pointers with a pointer to the actual object represented. The name pointers are not modified, so that the actual identifier names are still available. The lexicalseq for a module contains entries for any surroundingscope identifiers used by that module or by any procedures or modules contained within it.
The module name (modname) field points to the optional name of the module. If a module name is specified when the module is declared, the name appears there. If no module name is specified, this field will contain a value of NULL.
The static localseq points to an expression sequence listing the local variables that were explicitly declared as :static. Each entry is a NAME. Within the module, static locals are referred to by LOCAL structures, the local variable number being the index into the static localseq minus the number of nonstatic locals and exports. A static local shares its value among all instances of a class.
The static exportseq points to an expression sequence listing the exported module members declared as static. Each entry is a NAME. Within the module, exports are referred to by LOCAL structures, the local variable number being the number of elements in the localseq, static localseq, and exportseq, plus the index into the static exportseq.
The static nameseq stores the instances of the static locals and exports. It appears in the MODDEF structure as these static variables are shared among all modules with the same definition.


MODULE: Module Instance


MODULE

^exportseq

^moddef

^localseq



Maple syntax: none
Length: 4
Executing a module definition (MODDEF) results in a module instance. Each local or exported member of the module is instantiated and belongs to that instance of the module. The exportseq field points to an expression sequence of names of the instantiated exports (as opposed to the global names, as stored in the module definition). The moddef field points back to the original module definition. The localseq field points to an expression sequence of names of the instantiated local variables of the module.


NAME: Identifier


NAME

^assignedexpr

^attribexpr

characters

characters

...



Maple syntax: name
Length: 4 or more
The assignedexpr field points to the assigned value of the name. If the name has no assigned value, this field is a null pointer (not a pointer to NULL). The next field points to an expression sequence of attributes of the name. If there are no attributes, this field points to the empty expression sequence (NULL). The remaining fields contain the characters that form the name, stored 4 or 8 for each machine word (for 32bit and 64bit architectures respectively). The last character is followed by a zerobyte. Any unused bytes in the last machine word are also zero. The maximum length of a name is 268,435,447 characters on 32bit architectures and 34,359,738,351 characters on 64bit architectures.


NEXT: Next Statement


Maple syntax: next
Length: 1


NOT: Logical NOT


Maple syntax: not expr
Length: 2


OR: Logical OR


Maple syntax: expr1 or expr2
Length: 3


PARAM: Procedure Parameter in an Expression


Maple syntax: name
Length: 2
This structure indicates a parameter when it appears in a procedure. The integer is an index into the procedure paramseq. Several special PARAM structures exist:
This structure represents the Maple symbol _npassed (formerly nargs), the number of arguments passed when the procedure was called.
This structure represents the Maple symbol _passed (formerly args), the entire sequence of arguments passed when the procedure was called.
This structure represents the Maple symbol procname, referring to the currently active procedure.
This structure represents the Maple symbol _nresults, the number of results expected to be returned from the procedure.
This structure represents the Maple symbol _params, the sequence of declared positional arguments passed when the procedure was called.
This structure represents the Maple symbol _nparams, the number of declared positional arguments passed when the procedure was called.
This structure represents the Maple symbol _rest, the sequence of undeclared arguments passed when the procedure was called.
This structure represents the Maple symbol _nrest, the number of undeclared arguments passed when the procedure was called.
This structure represents the Maple symbol _options, the sequence of options in the procedure.
This structure represents the Maple symbol _noptions, the number of options in the procedure.
This structure represents the Maple symbol thisproc, referring to the instance of the currently active procedure.
At procedure execution time, the integer (if positive) is used as an index into the internal data structure Actvparams, which is part of the Maple procedure activation stack, and stores pointers to the values (which are also Maple structures) of the actual parameters passed to the procedure.


POLY: Multivariate Polynomials with Integer Coefficients


POLY

^indet_seq

m[i] degrees

m[i] coeff

m[i+1] degrees

m[i+1] coeff

...



Maple syntax:
Length: 2*(number of monomials) + 2
This is an internal representation for multivariate polynomials of limited degree and integer coefficients. SUM DAGs are automatically simplified to POLY DAGs if possible, provided the polynomial has at least two terms and its total degree is greater than 1.
Each degree word stores the total degree of the monomial and the individual degrees. For example, 5*x^2*y^3 + 1 is a twovariable polynomial whose first term has total degree 5: degree 2 in x, and degree 3 in y. The numbers 5, 2, and 3 are packed into a single degree word. The packing depends on the number of variables in the polynomial and the machine word length. Because the packing must fit in one word of memory, not all polynomials can be represented in this way. But many polynomials are stored in this data structure, which can be operated on efficiently.
Each coefficient word must be an integer data structure.
The indet_seq is the sequence of indeterminates that occur in the polynomial. The indeterminates must be Maple NAMEs or TABLEREFs. They are always sorted into descending order under the ordering used for sets.
The terms of the polynomial are always stored in graded lexicographical order. That is, monomials are compared first by their total degree, with ties broken by degree in the first variable, then degree the second variable, and so on.
If the sort command is used to sort a polynomial, and it would reorder either the terms or the variables, then the POLY DAG is automatically converted to a SUM DAG in place. Should this occur, it is not possible to convert the SUM back into a POLY.
The precise representation of monomials is as follows. For univariate polynomials, the entire degree word is used and the maximum degree of a POLY is the largest immediate integer kernelopts(maximmediate). For polynomials in n variables, we require n < WORDSIZE/2, so the maximum number of variables is 31 on a 64bit machine and 15 on a 32bit machine. The total degree and all of the exponents are given floor(WORDSIZE/(n+1)) bits each, flush against the bottom of the word. For example, on a 64bit machine a polynomial in x,y will use the lowest 21 bits for y, the next 21 bits for x, and the next 21 bits for the total degree. Any unused bits at the top of a word must remain unset.


POWER: Power


Maple syntax: expr1 ^expr2
Length: 3
This structure is used to represent a power when the exponent is not an integer, rational, or floatingpoint value. When the exponent is numeric, the POWER structure is converted to a length 3 PROD structure.


PROC: Procedure Definition


PROC

^paramseq

^localseq

^optionseq

^remtable

^statseq

^descseq



^globalseq

^lexicalseq

^eop

^returntype



Maple syntax:
proc ( paramSeq ) :: returnType;
description descSeq;
local localSeq;
export exportSeq;
global globalSeq;
option optionSeq;
statSeq
end proc



Length: 10 or 11 (the return type is optional)
The paramseq points to an expression sequence describing the formal parameters of the procedure. Each entry is either a NAME or a DCOLON (which, in turn, contains a NAME and an expression specifying a type). Within the procedure, parameters are referred to by PARAM structures, the parameter number being the index into the paramseq.
The localseq points to an expression sequence listing the explicitly and implicitly declared local variables. Each entry is a NAME. The explicitly declared variables appear first. Within the procedure, locals are referred to by LOCAL structures, the local variable number being the index into the localseq.
The optionseq field points to an expression sequence of options to the procedure (for procedures, options are the same as attributes). Each entry is a NAME or EQUATION specifying an option. Commonly used options are cache, operator, and `Copyright ...`.
The remtable field points to a hash table containing remembered values of the procedure. Entries in the table are indexed by the procedure arguments, and contain the resulting value. If there is no remember table, this field contains a pointer to NULL, which is the empty expression sequence.
The statseq field points to a single statement or a statement sequence (STATSEQ). If the procedure has an empty body, this is a pointer to NULL instead. For each procedure that is built into the kernel, there is a wrapper PROC that has the option builtin in its optionseq, and a single Maple integer pointed to by its statseq. The integer gives the builtin function number.
The descseq field points to an expression sequence of NAMEs or STRINGs. These are meant to provide a brief description of what the procedure does, and are displayed even when the interface(verboseproc) command is less than 2.
The globalseq field points to a list of the explicitly declared global variables in the procedure (those that appeared in the global statement). This information is never used at run time, but it is used when simplifying nested procedures to determine the binding of lexically scoped identifiers. For example, an identifier on the lefthand side of an assignment in a nested procedure can be global if it appears in the global statement of a surrounding procedure. This information is also used at procedure printing time, so that the global statement will contain exactly the same global identifiers that were declared in the first place.
The lexicalseq field points to an expression sequence of links to identifiers in the surrounding scope, if any. The sequence consists of pairs of pointers. The first pointer of each pair is to the globally unique NAME of the identifier; this is needed at simplification and printing time. The second pointer is a pointer to a LOCAL, PARAM, or LEXICAL structure which is understood to be relative to the surrounding scope. When a procedure is evaluated (not necessarily called), the lexicalseq is updated by replacing each of the second pointers with a pointer to the actual object represented. The name pointers are not modified, so that the actual identifier names are still available. The lexicalseq for a procedure contains entries for any surroundingscope identifiers used by that procedure or by any procedures contained within it.
The eop field is BINARY. The first entry specifies the number of positional parameters of the procedure. The remaining entries, if any, specify the evaluation order permutation for the procedure (that is, an evaluation order for the arguments that is consistent with any dependencies among the parameter specifications).
The returntype field is present only if a return type has been specified for the procedure. A return type is an assertion about the type of the value returned by the procedure; if kernelopts(assertlevel) is set to 2, then this type is checked as the procedure returns.


PROD: Product, Quotient, Power


PROD

^expr1

^expon1

^expr2

^expon2

...

...



Maple syntax: expr1 ^ expon1 * expr2 ^ expon2 ...
Length: 2n + 1
This structure is interpreted as pairs of factors and their numeric exponents. Rational or integer expressions to an integer power are expanded. If a rational constant is in the product, this constant is moved to the first entry by the simplifier. A simple power, such as , is represented as a PROD structure. More complex powers involving nonnumeric exponents are represented as POWER structures.


RANGE: Range


Maple syntax: expr1 .. expr2
Length: 3


RATIONAL: Rational


RATIONAL

^integer

^posinteger



Maple syntax: 1/2
Length: 3
This structure is one of the basic numeric objects in Maple. Note that this is not a division operation, but only a representation for rational numbers. Both fields must be integers (INTPOS, INTNEG, or an immediate integer) and the second must be positive.


READ: Read Statement


Maple syntax: read expr
Length: 2
The Maple read statement. The expression must evaluate to either a string or symbol (STRING or NAME structure), and specifies the name of the file to read.


RETURN: Return Statement


Maple syntax: return expr1, expr2, ...
Length: 2
The Maple return statement. The expression sequence is evaluated, giving the value(s) to return.


RTABLE: Rectangular Table


RTABLE

^data

^mapletype

^indexfunc

^attrib

flags

numelems





...

...

    