Module build¶
The compiler's stages as queries over a module graph: each module is checked against the interfaces of its imports, so an edit to a private body re-checks that module alone.
pipeline
¶
The compiler as incremental queries over a module graph.
ModuleBuild runs the stages of
compiling a QVR module graph as queries of a
QueryEngine, keyed by module
path:
| query | key | reads | result |
|---|---|---|---|
parse |
module | its source | the parse tree |
declared |
module | parse |
its name analysis |
imports |
module | declared |
the modules it imports |
names |
module | declared, imports' interface |
its names, constructors in scope included |
check |
module | names, imports, imports' interface and private |
its resolutions and interface |
interface |
module | check |
its public interface |
private |
module | declared, interface |
the names it declares without exporting |
order |
root | imports |
the graph's modules, dependencies first |
program |
root | every parse, names, check |
the flat program |
elaborate |
root | program |
the checked QIEC module (persisted) |
hashes |
root | elaborate |
the core hashes |
specialize |
root, computation, static arguments | elaborate |
the static arguments and the specialized type |
A module is checked against the interfaces of the modules it imports,
never their bodies, and an interface's fingerprint is its digest, so an edit
to a module's private body re-runs that module's check and stops at its
interface (early cutoff): no dependent is checked again. Elaboration
needs every body and runs on the flat program; its result is persisted in
the store, so a later process reuses the checked module (and the deductions
compiled into it) for an unchanged program without elaborating again. The
checked meta-phase library persists in the same store
(persisting_meta_library),
so a later process elaborating a changed program does not check it again.
ImportEdges
didactic-model
¶
ImportEdges(*, imports: tuple[ResolvedImport, ...] = ())
Bases: Model
The resolved imports of one module.
| PARAMETER | DESCRIPTION |
|---|---|
imports
|
Each import with the module it names.
TYPE:
|
Specialization
didactic-model
¶
Specialization(*, computation: str, arguments: tuple[StaticArgument, ...] = field(opaque=True, extras=OPAQUE_BY_VALUE), type: ComputationType = field(opaque=True, extras=OPAQUE_BY_VALUE))
Bases: ValueModel
A computation instantiated at closed static arguments.
| PARAMETER | DESCRIPTION |
|---|---|
computation
|
The computation's name.
TYPE:
|
arguments
|
The checked static arguments, in telescope order.
TYPE:
|
type
|
The computation's type with its telescope instantiated.
TYPE:
|
ModuleBuild
¶
ModuleBuild(loader: ModuleLoader, *, store: ArtifactStore | None = None)
Incremental compilation of the module graphs a loader provides.
| PARAMETER | DESCRIPTION |
|---|---|
loader
|
Finds a module's source by its path.
TYPE:
|
store
|
Where elaborations persist across processes, or None to keep them in memory.
TYPE:
|
Source code in src/quivers/incremental/pipeline.py
load
¶
Set the source of a module and of everything it imports.
| PARAMETER | DESCRIPTION |
|---|---|
module
|
The module's dotted path.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ModuleError
|
If a module is not found or is provided by two roots. |
Source code in src/quivers/incremental/pipeline.py
reload
¶
Read a module's source again, as after an edit.
| PARAMETER | DESCRIPTION |
|---|---|
module
|
The module's dotted path.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
bool
|
Whether its source changed. |
| RAISES | DESCRIPTION |
|---|---|
ModuleError
|
If the module is no longer found. |
Source code in src/quivers/incremental/pipeline.py
executed
¶
The keys a query ran for, in order.
| PARAMETER | DESCRIPTION |
|---|---|
query
|
The query name.
TYPE:
|
since
|
Skip the first
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
tuple[str, ...]
|
The keys of its |
Source code in src/quivers/incremental/pipeline.py
specialization_key
¶
The specialize key of a computation at static arguments.
| PARAMETER | DESCRIPTION |
|---|---|
root
|
The root module's path.
TYPE:
|
computation
|
The computation's name.
TYPE:
|
statics
|
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
str
|
A key that names the same specialization however the assignments are ordered. |