Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

PGX compilation core

pgx-core is the deterministic, editor-independent language engine behind PGX Quickstart. It preserves source-aware node declarations, ordered traversal syntax, contextual reference occurrences, document/profile provenance, derived graph edges, and policy-driven projections.

createCompilation({ source, sourceId, profile }) parses lawful node syntax separately from Schema Profile 1 interpretation. The returned compilation retains all declarations, diagnostics, pointer indexes, and reference occurrences. resolve(pointer, context, options) binds a pointer through explicit source layers. graphView(options) derives graph edges without discarding each reference's traversal grouping path.

Pointer identity comes from the Schema Profile 1 pointer field and is preserved exactly. Traversal references use generic bare atoms or JSON-style quoted atoms. pointerOccurrenceAt(offset) exposes declaration and reference spans to editor clients so navigation does not depend on a naming convention.

projectTraversal(compilation, expression, context, options) renders a structured projection result. inlineDepth: 0 produces a direct projection. A positive finite depth performs bounded inlining. inlineDepth: Infinity recursively expands traversal-valued descriptions. Pointer identity, declaration identity, provenance, and source spans remain attached to projected atoms even when their visible display is a title.

buildTraversalStructure(compilation, expression, context, options) creates a non-recursive tree projection of the authored expression. It retains source spans, ordered group paths, proximal pointer titles, provenance, resolution state, and pointer/group/depth metrics for editor structure views.

layoutTraversalStructure(structure, options) assigns stable top-down coordinates and ordered edges to that projection. It is a deterministic geometry adapter for small editor visualizations, not a general graph-layout engine.

Projection policies independently control display mode, resolution layers, unresolved references, cycles, recursive depth, pointer visits, expanded nodes, and output size. Results report status, projected AST, rendered text, diagnostics, and statistics. Cyclic graph structure remains representable; only cyclic textual expansion is marked or rejected according to policy.

The VS Code extension owns files, editor ranges, menus, and Markdown presentation. The stress checker and editor both consume this core, so A109 benchmarks the same compilation and projection path used by hover.