topos.graphs.ast.object¶
AST Representation¶
Adapts the existing ProgramObject to the
Representation protocol.
This does not replace ProgramObject; it wraps it so the
CharacteristicMorphism can treat it uniformly alongside other
representations (dependency graph, CFG, etc.).
The metrics produced by this representation are:
- ast.complexity – cyclomatic complexity
- ast.entropy – Kolmogorov proxy via compression ratio
- class topos.graphs.ast.object.ASTRepresentation(program_object, source)[source]
Bases:
objectRepresentation adapter for Abstract Syntax Trees.
Wraps a
ProgramObjectand its source text, exposing complexity and entropy as representation-level metrics.- program_object
The underlying parsed AST.
- Type:
ProgramObject
- source
The original source code (needed for entropy).
- Type:
- program_object
- source
- property name
- property dimension
- metrics()[source]