The analysis package takes standard compiler.ast
nodes and annotates them with additional information which is then used
in subsequent activities such as code generation and documentation.
Below are tables showing the annotations used for various AST nodes:
Node | Annotation | Purpose |
---|---|---|
* | _contexts | Indicates the types that the node is considered to have, along with the context in which it has them. A dictionary mapping contexts to types/references. |
Node | Annotation | Purpose |
---|---|---|
Function Module Class Reference Stmt |
_namespace | A dictionary mapping names to lists of defining nodes for each name. Some Stmt nodes have _namespace annotations when employed by conditional or loop nodes. |
Function | _globals | Provides a list of globals used in the function. |
Name | _scope | Indicates which scope the name uses to refer to a variable. |
Module | _constants_table | A list of constants in the module. |
Module | _module_name | Same as _qualified_name. |
Function Module Class |
_qualified_name | (As specialisation.) Provides a qualified name for the function for use in generated code. |
Node | Annotation | Purpose |
---|---|---|
Reference | _class |
Indicates the class of a particular reference. |
Class | _instances | A list of instances (references) for a given class. |
CallFunc Const List Compare |
_instantiates | Indicates that the node instantiates a particular reference. |
Node | Annotation | Purpose |
---|---|---|
Compare | _ops |
A list of operator objects summarising the binary operations employed in the comparison. |
Function | _original | (As specialisation.) Indicates the original function used to produce the specialisation. |
Function AssList AssName AssTuple |
_parent | Indicates the parent node of a node - useful for adding sibling nodes (specialisations of functions) or for tracking the processing of expressions (assignment processing). |
Function | _signatures | A list of signatures each corresponding to a specialisation in the _specialisations annotation; together, these annotations should be considered as a table. |
Function | _specialisations | A list of specialisations created for a particular function. |
CallFunc | _targets | A list, representing a sequence of invocations, containing lists of specialisations that may be involved in each invocation. |
CallFunc | _args | A list, representing a sequence of invocations, containing argument lists that are associated with each invocation's target specialisations. |
CallFunc | _star_args | A list, representing a sequence of invocations, containing argument lists that are associated with each invocation's target specialisations. |
CallFunc | _dstar_args | A list, representing a sequence of invocations, containing argument lists that are associated with each invocation's target specialisations. |