Overview of Intermediate Code Structure
Description
Input to CodeGeneration is first transformed to Intermediate Code, an expression consisting of nested unevaluated function calls, which represents a simplified form of the input.
The Intermediate Code is the basic structure on which both built-in and user-created translators operate. The names of the functions used in Intermediate Code expressions are members of the CodeGeneration,Names subpackage.
The following table lists the names used in Intermediate Code.
And
ArrayAssignment
ArrayIndices
ArrayInitialization
ArrayRanges
ArrayType
ArrayVariable
AssignedName
Assignment
Break
Coercion
ConditionalPair
Declaration
DescriptionSequence
Equal
Error
ExportSequence
Expression
ExpressionSequence
Float
ForFromLoop
FunctionCall
GeneratedName
GlobalSequence
If
Integer
Inverse
Less
LessEqual
LexicalSequence
List
ListArray
LocalSequence
Module
ModuleDefinition
Name
Negation
Next
Not
NotEqual
OptionSequence
Or
ParameterSequence
Power
Procedure
Product
Range
Rational
Return
ReturnVariableName
Scope
Statement
StatementSequence
String
Sum
Try
Type
Values
WhileLoop
The form and purpose of each of the Intermediate Code names is explained in detail in the following table. The names arg1, arg2, ... refer to the required arguments as given under Form.
Form
And(Expression, Expression)
The logical expression, "arg1 and
arg2".
Array
Array(
An array, where arg1 is the ranges of
ArrayRanges, Values(
the array, and arg2 contains the
{ArrayIndices=Expression}+))
values which it holds.
ArrayAssignment(Expression,
Assignment of one array to another
Expression,
array, where arg1 is the name of
list({ArrayIndices}+))
the first array, arg2 is the name
of the second array, and arg3 is a
list of indices necessary for
element-wise assignments.
ArrayIndices({Expression}+)
An index to an array element; the
arguments are a sequence of indices
whose number corresponds to the
dimension of the array.
ArrayInitialization(
Assignment of multiple values to an
Expression, Array)
array, where arg1 and arg2 are the
name and ranges of the target array,
and arg3 contains the values
corresponding to each set of indices.
ArrayRanges({range}+)
Ranges associated with an array.
ArrayType(Type, ArrayRanges)
An array type, where arg1 is the
element type and arg2 contains the
ranges of the array.
ArrayVariable(Expression,
An array element, where arg1 is the
ArrayIndices)
name of the array, and arg2 is the
index of this array element.
AssignedName(
An assigned name, where arg1 is
{Name | GeneratedName},
the name and arg2 is the value.
Expression)
Assignment(Expression,
An assignment of arg2 to arg1.
Break()
A break statement, that is, an
instruction to jump to the end of the
current ForFromLoop or WhileLoop
structure.
Coercion(Expression, Type)
A coercion of arg1 to type arg2.
ConditionalPair(Expression,
A conditional pair, where arg1 is a
StatementSequence)
condition and arg2 is the statement
sequence to be executed if the
condition is true.
Declaration(Name,
A declaration that arg1 has type arg2.
Type | ArrayType)
DescriptionSequence(
A sequence of descriptions.
{Expression}*)
Equal(Expression, Expression)
The relation "arg1 = arg2".
Error(string,
A error statement; arg1 is a format
list({Expression}+)
string similar to that used by the
Maple error command; arg2 is a list
of expressions to be substituted
into numbered parameter locations
in arg1.
ExportSequence({Declaration}*)
A sequence of exported variables.
And | ArrayVariable |
An expression.
AssignedName |
Coercion | Equal |
ExpressionSequence |
Float |
FunctionCall |
GeneratedName |
Integer | Inverse |
Less | LessEqual |
List | ListArray |
Name | Negation | Not |
NotEqual | Or | Power |
Product | Range|
Rational | String | Sum
ExpressionSequence(
A sequence of expressions; arg1 is a
list containing these expressions.
Float(nonnegint,
A positive floating-point number,
integer)
where arg1 and arg2 are the mantissa
and exponent respectively.
ForFromLoop(Expression,
A "for" (counter-controlled) loop.
Expression, Expression,
The arguments represent the loop
counter, the start value, the step
and the end value, respectively;
arg5 is the body of the loop.
FunctionCall(Name,
A function call, where arg1 is the
ExpressionSequence, funcsig)
name of the function, arg2 is an
expression sequence containing the
arguments, and arg3 is the function
signature having the form
GeneratedName(string)
A name generated by Maple.
GlobalSequence({Declaration}*)
A sequence of global variables.
If({ConditionalPair,
An "if" statement, where arg1 is a
StatementSequence}*)
list of conditional pairs which
correspond to "if" and "else if"
clauses and arg2 (optional) is the
body of the "else" clause.
Integer(nonnegint)
A non-negative integer.
Inverse(Expression, name)
The inverse of an expression,
that is, 1/arg1; arg2 is the type of
the expression (integer or numeric).
Less(Expression, Expression)
The relation, "arg1 < arg2".
LessEqual(Expression,
The relation, "arg1 <= arg2".
LexicalSequence({Declaration}*)
A sequence of lexical variables.
List({Expression}*)
A list of expressions.
ListArray({Expression}*)
LocalSequence({Declaration}*)
A sequence of local variables.
Module(ExpressionSequence,
A module. arg1 is an exprseq of
ModuleDefinition,
a list of instantiated exports, arg2
ExpressionSequence)
a is the module definition, and arg3
is an exprseq of instantiated local
variables.
ModuleDefinition(
A module definition:
ParameterSequence,
arg1 holds the formal parameters,
LocalSequence,
arg2 the module local variables,
OptionSequence,
arg3 the module options,
ExportSequence,
arg4 the module exports,
StatementSequence,
arg5 the body,
DescriptionSequence,
arg6 the description string,
GlobalSequence,
arg7 the global variables,
LexicalSequence,
arg8 the lexical table,
arg9 the formal module name
(if the module is named).
Name(string)
A name.
Negation(Expression)
The negation of arg1.
Next()
A next statement, that is, an
instruction to jump to the start of
the current ForFromLoop or
WhileLoop structure, incrementing the
loop counter in the case of a
ForFromLoop.
Not(Expression)
The logical expression, "not arg1".
NotEqual(Expression,
The relation, "arg1 <> arg2".
OptionSequence({Name}*)
A sequence of procedure/module
options.
Or(Expression, Expression)
The logical expression, "arg1 or
ParameterSequence(
A sequence of parameters.
{Declaration}*)
Power(Expression, Expression)
The expression, "arg1 raised to the
power arg2".
Procedure(
A procedure:
arg2 the local variables,
arg3 the procedure options,
arg4 the remember table,
arg5 the procedure body,
Type)
arg9 the return type.
Product({Expression}+)
A product of terms.
Range({range}+)
A sequence of ranges.
Rational(posint, posint)
A positive rational number,
arg1/arg2.
Return(Expression)
A return statement, where arg1 is
the expression to be returned.
ReturnVariableName()
structure used to represent the name
of the return variable, if present
Scope(symboltables, icode)
data structure for a complete IC
including symbol tables
Statement(Expression)
An expression that is also a complete
statement.
StatementSequence(
A sequence of statements.
{Statement, Assignment,
Error, ForFromLoop, If,
Return, WhileLoop}*)
String(string)
A string.
Sum({Expression}+))
A sum of terms.
Try(StatementSequence,
A try/catch/finally block. arg1 is the
{Expression |
try block, arg2 is the catch block.
Type(name)
A type name.
Values({Expression}+)
container for array values
WhileLoop(Expression,
A "while" (condition-controlled) loop,
where arg1 is the condition and arg2
is the body of the loop.
See Also
CodeGeneration,Names
IntermediateCode
LanguageDefinition
Download Help Document