marianoguerra/pure-py/analysis does not have a README file

    NameSet

    The syntactic analyses of Annex A.1: what a statement assigns, what it binds, what it captures, and where its free variables are.

    A port of the reference's aux.py, function for function, so that the two can be read side by side. Two things carry over deliberately:

    • Sets are sorted. The reference uses Python's set and then min or sorted wherever the choice is observable, so no order is ever accidental. Sorted sets here make that structural rather than a habit.
    • A mutual region is formed on the fly. statements groups a run of consecutive defs into one item, and nothing in the tree records it. The evaluator groups the same way, from the same function.

    Statement

    A PurePy statement: a Python statement, or a mutual region of consecutive function definitions. A Python body is the spec's right-nested sequence.

    assigns_statement

    binds_seq

    In source order, with repeats: the linearity check counts them.

    captures_quals_of

    What a run of comprehension clauses captures, for a caller that has a whole array rather than a view.

    captures_region

    What a whole mutual region captures: the free names of every body, less the parameters, less what each body assigns for itself, less the region's own names -- which is what lets even and odd name each other.

    captures_statement

    fn captures_statement(item : Statement) ->
    SortedSet
    [String]

    find_first_reassigning

    The first statement in a sequence that assigns any of names_ -- the one a captured-then-reassigned message points at. For a region it is the region's first definition, as the reference reports.

    find_import

    The first import anywhere in a list, for the "imports must precede all other statements" check.

    find_nested_import

    fn find_nested_import(stmts : Array[
    Stmt
    ], nested? : Bool) ->
    Stmt
    ?

    The first import inside a function, a branch or a case body -- which is where an import is not allowed at all.

    is_import

    fn is_import(s :
    Stmt
    ) -> Bool

    is_qualified_name

    fn is_qualified_name(e :
    Expr
    ) -> Bool

    own_fields

    fn own_fields(node :
    Stmt
    ) -> Array[String]

    The fields a class declares itself, in declaration order.

    qualified_name

    fn qualified_name(e :
    Expr
    ) -> String

    a, a.b, a.b.c as text.

    split_imports

    The leading run of imports, and everything after it.

    statements

    Group a body into statements: a run of consecutive defs is one region.

    Source Files

    Powered by MoonBit

    Site sourceReport issuePackagesBuild queueSkillsStatistics

    © 2026 mooncakes.io