micropython

Annotated docs/annotations.txt

804:c967b47fada4
2014-06-01 Paul Boddie Merged branches. syspython-as-target
paul@353 1
AST Node Annotations
paul@353 2
====================
paul@353 3
paul@603 4
These annotations are defined in the revised compiler.ast classes.
paul@498 5
paul@646 6
Deduction Results
paul@646 7
-----------------
paul@646 8
paul@789 9
_access_attrs       the deduced attributes involved in an access provided as
paul@789 10
                    a collection of (attribute, value) pairs, where the value
paul@789 11
                    may be None; details of the deductions are given in the
paul@789 12
                    following annotations
paul@698 13
_access_type        ("constant", "static", "positioned", "instance",
paul@698 14
                     "impossible")
paul@669 15
                    defines the kind of access involved for a particular node
paul@646 16
                    and determines which of the following annotations will be
paul@698 17
                    employed, except for "impossible" which indicates an error
paul@698 18
                    condition
paul@669 19
_value_deduced      (_access_type is "constant")
paul@669 20
                    defines a specific result associated with an attribute
paul@646 21
                    access during deduction and based on inspection results
paul@669 22
_attr_deduced       (_access_type is "static" or "instance")
paul@669 23
                    defines an attribute result according to deduction based
paul@646 24
                    on inspection results, with the accessor being the parent
paul@646 25
                    defined in this object for static attributes
paul@669 26
_position_deduced   (_access_type is "positioned")
paul@669 27
                    defines a common position employed by all deduced
paul@646 28
                    attributes for an access operation which is relative to
paul@646 29
                    the accessor evaluated at run time
paul@710 30
_set_context        (_access_type is "constant" or "static")
paul@710 31
                    ("set", "cond", None)
paul@710 32
                    indicates the deduced effect on the context in an access
paul@646 33
                    operation, whether the context would be replaced
paul@646 34
                    unconditionally or conditionally
paul@710 35
                    
paul@646 36
paul@710 37
_attrs_deduced_from_specific_usage
paul@646 38
_attrs_deduced_from_usage
paul@646 39
_attrs_deduced
paul@646 40
                    provided as additional annotations more suitable for
paul@646 41
                    report generation than code generation, since they
paul@646 42
                    describe a range of deduced attributes for a given node,
paul@646 43
                    but such ranges may not lend themselves to the generation
paul@646 44
                    of optimised code
paul@646 45
paul@556 46
Evaluation Results
paul@556 47
------------------
paul@556 48
paul@669 49
_attr               (may identify static attributes for classes and modules,
paul@795 50
                     is otherwise given as a general instance but may also be
paul@795 51
                     an unresolved name)
paul@669 52
                    notes the result associated with an attribute access
paul@664 53
                    operation during inspection; this may be a general
paul@664 54
                    instance providing no specific information about the
paul@664 55
                    nature of an attribute
paul@603 56
_expr               records the result of evaluating an expression used in an
paul@603 57
                    attribute access operation
paul@556 58
paul@388 59
Attribute Users
paul@388 60
---------------
paul@388 61
paul@787 62
_attrtypes          defines types deduced from combined attribute usage
paul@787 63
                    details (for users), indicating a set of (attribute,
paul@787 64
                    value) tuples for each name
paul@712 65
_values             defines a name-to-value mapping for objects that may be
paul@712 66
                    used to access attributes
paul@786 67
_guard_types        mapping from names to ("single", "multiple", "impossible")
paul@786 68
                    defines the nature of any type check upon assignment of an
paul@786 69
                    object to a name/user; an impossible guard occurs when
paul@786 70
                    concrete type information conflicts with deduced type
paul@786 71
                    information
paul@786 72
_guards             a mapping to a set of actual guard types to which the
paul@786 73
                    assigned object must comply
paul@571 74
paul@571 75
Attribute Contributors
paul@571 76
----------------------
paul@571 77
paul@571 78
_attrnames          defines a dictionary mapping local names to sets of
paul@571 79
                    attribute names found to be used with those names in a
paul@571 80
                    branch
paul@599 81
_attrbranches       indicates the immediate contributors to attribute usage
paul@599 82
                    known to a node
paul@599 83
_attrcontributors   defines nodes contributing to combined attribute usage known
paul@723 84
                    to a node (and is thus the accumulation of all contributors
paul@723 85
                    via branches)
paul@723 86
_attrdefs           defines definition-related users which consume usage details
paul@723 87
                    from the node (and is thus the accumulation of all
paul@723 88
                    definitions affected by the node)
paul@599 89
_attrcombined       defines a dictionary mapping local names to sets of
paul@599 90
                    attribute names found to be used with those names for the
paul@599 91
                    entire lifetime of a particular attribute user
paul@489 92
_attrmerged         defines a dictionary mapping local names to sets of
paul@489 93
                    attribute names merging combined observations with locally
paul@489 94
                    applicable observations, indicating usage specific to a
paul@489 95
                    region of the code
paul@490 96
_attrspecifictypes  defines specific types from merged attribute usage details
paul@490 97
                    (for non-user nodes)
paul@388 98
paul@388 99
Attribute Accessors
paul@388 100
-------------------
paul@388 101
paul@488 102
_attrusers          defines a dictionary mapping local names to sets of nodes
paul@488 103
                    defining those names
paul@603 104
_username           indicates the name of the attribute user involved in an
paul@603 105
                    access operation
paul@388 106
paul@388 107
Name Accessors
paul@388 108
--------------
paul@388 109
paul@488 110
_scope              set as "constant", "local", "global" or "builtins"
paul@388 111
paul@388 112
Program Units
paul@388 113
-------------
paul@388 114
paul@488 115
unit                refers to a micropython Class, Function or Module instance