backend

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 3, 2026 License: MIT Imports: 31 Imported by: 0

Documentation

Overview

Code generated by cmd/uast-emission-recipes; DO NOT EDIT. Source: exact M_EO emission-contract factorization.

Code generated from the checked-in direct-UAST renderer catalog; DO NOT EDIT.

Index

Constants

View Source
const ExactCallResolutionCapability = "call.resolution.exact.v1"
View Source
const ExactSignatureCapability = "function.signature.exact.v1"
View Source
const SemanticDocumentSchema = "r2many.semantic-program"

SemanticDocument is the stable interchange format for SemanticProgram. It intentionally contains no Canonical R text and can therefore move between a source frontend, a route decoder and every target backend without R carrying semantic state. The source-specific parser remains an adapter at the edge.

View Source
const SemanticDocumentVersion = 1

Variables

View Source
var Languages = []Language{
	{"go", "Go", ".go", "//"},
	{"rust", "Rust", ".rs", "//"},
	{"cpp", "C++", ".cpp", "//"},
	{"c", "C", ".c", "//"},
	{"python", "Python", ".py", "#"},
	{"zig", "Zig", ".zig", "//"},
	{"julia", "Julia", ".jl", "#"},
	{"nim", "Nim", ".nim", "#"},
	{"csharp", "C#", ".cs", "//"},
	{"java", "Java", ".java", "//"},
	{"kotlin", "Kotlin", ".kt", "//"},
	{"swift", "Swift", ".swift", "//"},
}
View Source
var PrimitiveMatrix = []PrimitiveSpec{}/* 702 elements not displayed */
View Source
var StructuredFieldCoverage = map[string][]string{
	"CONTAINER":              {"node kind", "child", "operand", "type", "binding", "allocation size"},
	"ITERATION":              {"node kind", "iterable", "binding", "child", "control/body reference", "filter/condition"},
	"CLOSURE_FUNCTION_VALUE": {"node kind", "parameter", "capture", "binding", "child", "control/body reference"},
	"INDEX_SLICE":            {"node kind", "operand", "index", "slice bounds", "binding"},
}

StructuredFieldCoverage is the exact field basis used by the four shared extractor families. A missing cell is diagnostic evidence, never a request to reconstruct source spelling.

Functions

func BackendCapabilities

func BackendCapabilities(name string) []string

func EmitSemantic

func EmitSemantic(target string, p *SemanticProgram) (string, error)

func EnrichUniversalAST added in v1.0.5

func EnrichUniversalAST(u *UniversalASTDocument) error

EnrichUniversalAST is the shared, UAST-only semantic enrichment pass. It materializes only facts that follow from schema crosswalks and explicit syntax roles; frontend-specific parsers and SemanticDocument are absent.

func EquivalentSemanticObservations

func EquivalentSemanticObservations(a, b SemanticObservation) bool

func HasBackend

func HasBackend(name string) bool

func HasFrontend

func HasFrontend(name string) bool

func MatrixFrontendLanguages added in v1.0.5

func MatrixFrontendLanguages() []string

MatrixFrontendLanguages exposes every language currently backed by the matrix grammar extractor. Each uses the same typed-event contract.

func MissingStructuredFields added in v1.0.6

func MissingStructuredFields(input StructuredConstructInput) []string

func NeedsParentheses added in v1.0.5

func NeedsParentheses(parent, child TargetOperatorSpec, role string) bool

NeedsParentheses is target-neutral: TargetSpec supplies precedence and associativity while the algorithm uses only operand role.

func NormalizeLanguage

func NormalizeLanguage(name string) string

func Run

func Run(src string) (string, error)

func RunSemantic

func RunSemantic(program *SemanticProgram) (string, error)

RunSemantic executes the semantic tree directly. It is used for IR round-trip equivalence checks and never reconstructs source text.

func RuntimeSource

func RuntimeSource(target string) (string, error)

RuntimeSource returns the actual support code embedded in generated programs. It does not contain a compiler or an external language installation.

func StructuredInputFields added in v1.0.6

func StructuredInputFields(input StructuredConstructInput) map[string]bool

func SupportsCapability

func SupportsCapability(caps []string, capability string) bool

func SyntaxFailureSignature added in v1.0.6

func SyntaxFailureSignature(diagnostic string) string

SyntaxFailureSignature groups actual target diagnostics into the stable matrix vocabulary. It does not infer a cause; unrecognised diagnostics are preserved as "other" for review.

func Transpile

func Transpile(target, src string) (string, error)

func TranspileFrom

func TranspileFrom(source, target, src string) (string, error)

TranspileFrom retains argument-evaluation semantics when the canonical syntax originated in an eager source language rather than R.

func UASTTargetProjectionCapabilities added in v1.0.5

func UASTTargetProjectionCapabilities() (map[string]map[string]PreservationMode, error)

UASTTargetProjectionCapabilities folds the exact structure decisions back to the historical 13×73 class matrix. A class is only marked supported when all members are supported; the per-structure matrix above is used for actual executable capability decisions and never loses a proved member.

func UASTTargetStructureProjectionCapabilities added in v1.0.5

func UASTTargetStructureProjectionCapabilities() (map[string]map[string]PreservationMode, error)

UASTTargetStructureProjectionCapabilities is the exact target-side availability of every structure contract. It is derived from declarative TargetSpec forms and the generated template quotient, never from a guess based on a target-language name. It remains structure-granular because an execution-equivalent projection class can contain multiple syntax forms.

func ValidateSemanticProgram added in v1.0.5

func ValidateSemanticProgram(p *SemanticProgram) error

ValidateSemanticProgram checks the live tree and recomputes its evidence. Mutating Body without updating its relations cannot bypass JSON validation.

func WalkSemanticDocument

func WalkSemanticDocument(doc *SemanticDocument, visitor SemanticVisitor) error

func WriteUASTMatrixEngineInputs added in v1.0.5

func WriteUASTMatrixEngineInputs(dir string) error

WriteUASTMatrixEngineInputs adapts existing, checked-in UAST matrices to the offline uast-matrix-engine contract. It performs no closure, matrix product, readiness selection, or preservation selection. Those operations belong to the external engine. In particular, language facet evidence is already an exact quotient class in the source matrix, so it is emitted as a stable evidence feature rather than being expanded back into guessed source rows.

Types

type Arg

type Arg struct {
	Name    string
	Value   Expr
	Missing bool
}

type AssignStmt

type AssignStmt struct {
	Name, Op string
	Value    Expr
}

type BackendSpec

type BackendSpec struct {
	ID           string
	Aliases      []string
	Capabilities []string
	Dialects     []string
}

func Backends

func Backends() []BackendSpec

type BinaryExpr

type BinaryExpr struct {
	Op   string
	L, R Expr
}

type BlockStmt

type BlockStmt struct{ List []Stmt }

type BreakStmt

type BreakStmt struct{}

type CallExpr

type CallExpr struct {
	Fun        Expr
	Args       []Arg
	Eager      bool // explicit call boundary, including decoded R force wrappers
	Resolution *SemanticCallResolution
}

type CapabilityMatrix added in v1.0.5

type CapabilityMatrix struct {
	Features    []string              `json:"features"`
	Targets     []string              `json:"targets"`
	Native      matrixir.SparseMatrix `json:"native"`
	Lowering    matrixir.SparseMatrix `json:"lowering"`
	Emulated    matrixir.SparseMatrix `json:"emulated"`
	Unsupported matrixir.SparseMatrix `json:"unsupported"`
}

CapabilityMatrix is feature x target. Status planes are mutually exclusive; Unsupported is explicit so unknown features cannot look like supported zeros.

func SemanticCapabilityMatrix added in v1.0.5

func SemanticCapabilityMatrix(extra []string) CapabilityMatrix

func (CapabilityMatrix) RejectedTargets added in v1.0.5

func (m CapabilityMatrix) RejectedTargets(requirements []string) (matrixir.SparseMatrix, error)

RejectedTargets computes requirements^T * unsupported. A positive entry is the count of unavailable requirements for that target, not a quality score.

type CapabilityResult

type CapabilityResult struct {
	Feature string           `json:"feature"`
	Backend string           `json:"backend"`
	Status  CapabilityStatus `json:"status"`
	Reason  string           `json:"reason,omitempty"`
}

CapabilityResult is a backend contract, not a success prediction. The caller can display it before emitting and refuse any non-exact policy.

func BackendCapability

func BackendCapability(feature, backend string) CapabilityResult

type CapabilityStatus

type CapabilityStatus string
const (
	CapabilityNative      CapabilityStatus = "native"
	CapabilityLowering    CapabilityStatus = "lowering"
	CapabilityEmulated    CapabilityStatus = "emulated"
	CapabilityUnsupported CapabilityStatus = "unsupported"
)

type DirectLoweringAnalysis added in v1.0.5

type DirectLoweringAnalysis struct {
	Schema              string                      `json:"schema"`
	Rows                []DirectLoweringRequirement `json:"rows"`
	AtomicObligations   []string                    `json:"atomic_obligations"`
	MissingVectors      map[string][]string         `json:"missing_vectors"`
	Classes             map[string][]string         `json:"classes"`
	Primitives          []string                    `json:"primitives"`
	ConnectedComponents int                         `json:"connected_components"`
	DataOnlyPrimitives  int                         `json:"data_only_primitives"`
	NewHandlerClasses   int                         `json:"new_handler_classes"`
}

func WriteDirectLoweringAnalysis added in v1.0.5

func WriteDirectLoweringAnalysis(out, candidateCSV string) (DirectLoweringAnalysis, error)

type DirectLoweringContract added in v1.0.5

type DirectLoweringContract struct {
	Target          string
	ProjectionClass string
	Primitive       string
	Handler         string
	RecipeIDs       []string
	TemplateID      string
	ProofStatus     string
}

DirectLoweringContract is a checked product-path registration. It stores no program data and is deliberately narrower than a projection form: a target may use the generic syntax recipe only after the named native semantic handler and its proof gate are registered.

func DirectLoweringContractFor added in v1.0.5

func DirectLoweringContractFor(target, projectionClass string) (DirectLoweringContract, bool)

type DirectLoweringRequirement added in v1.0.5

type DirectLoweringRequirement struct {
	CandidateID, Target, ProjectionClass string
	UASF                                 []string
	Required, Existing, Missing          []string
	Classification                       string
}

DirectLoweringRequirement is one row of M_CO. It describes only registry contracts and existing emission machinery; it is not a program IR.

type Doc added in v1.0.5

type Doc interface {
	// contains filtered or unexported methods
}

Doc is a syntax-only, ephemeral rendering tree. It contains no types, symbols, UAST nodes, or semantic meaning.

func EmitNativeDocument added in v1.0.5

func EmitNativeDocument(spec TargetSpec, source string) (Doc, error)

EmitNativeDocument is the central DIRECT document boundary. The semantic projector has already lowered every UAST node through the native target renderer; this final recipe carries the resulting syntax document through the same NativeEmitterContract without reintroducing a runtime or a second semantic representation. Keeping this operation here makes it impossible for a DIRECT projection to bypass the native emitter dispatch point.

func EmitNativeExecution added in v1.0.5

func EmitNativeExecution(spec TargetSpec, recipe EmissionRecipe, template TargetSyntaxTemplateCell, input NativeEmissionInput) (Doc, error)

EmitNativeExecution is the single data-driven native emission entry point. It composes an existing emission recipe with an existing target template and TargetSpec. No target×primitive dispatch or runtime helper is introduced.

func ExecuteEmissionRecipe added in v1.0.5

func ExecuteEmissionRecipe(recipe EmissionRecipe, input EmissionRecipeInput, spec TargetSpec) (Doc, error)

ExecuteEmissionRecipe builds only a layout Doc. It never selects a semantic lowering, resolves symbols, or interprets a source language. An empty role remains empty; the executor never invents a child or a target token.

func ExecuteTargetSyntaxTemplate added in v1.0.5

func ExecuteTargetSyntaxTemplate(recipe EmissionRecipe, template TargetSyntaxTemplateCell, spec TargetSpec, input EmissionRecipeInput) (Doc, error)

ExecuteTargetSyntaxTemplate applies only an already-registered template and delegates all layout to the three generic emission handlers. It cannot turn a missing target template into source text.

func NativeDeclarationEmitter added in v1.0.5

func NativeDeclarationEmitter(spec TargetSpec, recipe EmissionRecipe, template TargetSyntaxTemplateCell, input NativeEmissionInput) (Doc, error)

func NativeEmitterCapabilityDoc added in v1.0.5

func NativeEmitterCapabilityDoc(target, capability string, spec TargetSpec, body Doc) (Doc, error)

NativeEmitterCapabilityDoc provides the shared backend representation for the three previously runtime-terminal capabilities. It is layout-only and contains no UAST or program semantics.

func NativeExpressionEmitter added in v1.0.5

func NativeExpressionEmitter(spec TargetSpec, recipe EmissionRecipe, template TargetSyntaxTemplateCell, input NativeEmissionInput) (Doc, error)

NativeExpressionEmitter, NativeStatementEmitter and NativeDeclarationEmitter are deliberately thin category wrappers around the same generic emitter. Their category is selected by the already registered projection form, never by a target-specific switch.

func NativeStatementEmitter added in v1.0.5

func NativeStatementEmitter(spec TargetSpec, recipe EmissionRecipe, template TargetSyntaxTemplateCell, input NativeEmissionInput) (Doc, error)

type DocConcat added in v1.0.5

type DocConcat struct{ Parts []Doc }

type DocHardLine added in v1.0.5

type DocHardLine struct{}

type DocIndent added in v1.0.5

type DocIndent struct {
	By   string
	Body Doc
}

type DocText added in v1.0.5

type DocText struct{ Text string }

type EmissionContractAnalysis added in v1.0.5

type EmissionContractAnalysis struct {
	Contracts   []string
	Operations  []string
	Combinators []ProjectionObligationPrimitive
}

EmissionContractAnalysis is the syntax-only M_EO factorization. Atomic operations are the already validated projection obligations; no semantic datum or UAST node is copied into this registry.

func UniversalEmissionContractAnalysis added in v1.0.5

func UniversalEmissionContractAnalysis() (EmissionContractAnalysis, error)

func WriteEmissionContractAnalysis added in v1.0.5

func WriteEmissionContractAnalysis(dir string) (EmissionContractAnalysis, error)

type EmissionHandlerClass added in v1.0.5

type EmissionHandlerClass string

EmissionHandlerClass groups atomic matrix operations by identical syntax-only execution behavior. It is deliberately independent of UASF, source language, structural kind, and target identity.

type EmissionRecipe added in v1.0.5

type EmissionRecipe struct {
	ID         string
	Archetypes []string
	Operations []EmissionRecipeOperation
}

EmissionRecipe is an ephemeral syntax plan. It holds no program facts: nodes, types, symbols and relations remain in UniversalASTDocument.

func GeneratedEmissionRecipeForPrimitive added in v1.0.5

func GeneratedEmissionRecipeForPrimitive(id string) (EmissionRecipe, bool, error)

GeneratedEmissionRecipeForPrimitive is used by the direct projector's preflight to verify that every residual syntax contract has a compiled layout plan. It does not upgrade target preservation modes by itself.

type EmissionRecipeChild added in v1.0.5

type EmissionRecipeChild struct {
	Role    string
	Ordinal int
	Doc     Doc
}

EmissionRecipeChild preserves the proven syntax.child role and ordinal while holding only an already-rendered ephemeral Doc.

type EmissionRecipeInput added in v1.0.5

type EmissionRecipeInput struct {
	NodeID   int
	Children []EmissionRecipeChild
}

EmissionRecipeInput adapts a single canonical UAST node to the generic executor. It intentionally excludes all semantic values except the node ID for diagnostics; children are passed as already-rendered syntax fragments.

type EmissionRecipeOperation added in v1.0.5

type EmissionRecipeOperation struct {
	Atomic  string
	Handler EmissionHandlerClass
	Slot    string
}

EmissionRecipeOperation is one generated entry of M_EO. Atomic is retained verbatim so its matrix provenance can be checked before any Doc is built.

type EmissionRecipeRegistry added in v1.0.5

type EmissionRecipeRegistry struct {
	Recipes        map[string]EmissionRecipe
	HandlerClasses []EmissionHandlerClass
}

EmissionRecipeRegistry is the cached result of compiling the generated data. Recipes are built once per process and execution is O(recipe length).

func UniversalEmissionRecipeRegistry added in v1.0.5

func UniversalEmissionRecipeRegistry() (EmissionRecipeRegistry, error)

UniversalEmissionRecipeRegistry returns the build-cached generated recipes.

type ExecutionPrimitiveMatrixAnalysis added in v1.0.5

type ExecutionPrimitiveMatrixAnalysis struct {
	Schema                                                                                         string `json:"schema"`
	Targets, ProjectionClasses, Primitives                                                         []string
	E                                                                                              matrixir.SparseMatrix `json:"e"`
	R, S, SDirect, SClosed, M                                                                      matrixir.SparseMatrix
	Direct                                                                                         map[string]map[string]bool `json:"direct"`
	NativeSupportCells, DerivedSupportCells, ClosedSupportCells                                    int
	MissingCells, SemanticMissingCells, DirectCells, ExistingDirectCells, ReconstructedDirectCells int
	Contradictions                                                                                 []string `json:"contradictions"`
	UnknownSupportCells                                                                            int      `json:"unknown_support_cells"`
	ResidualClasses                                                                                int      `json:"residual_classes"`
	SolveObligations                                                                               int      `json:"solve_obligations"`
	NativeProven                                                                                   int      `json:"native_proven"`
	NativeImpossible                                                                               int      `json:"native_impossible"`
	Conflicts                                                                                      int      `json:"conflicts"`
	InsufficientProof                                                                              int      `json:"insufficient_proof"`
	ExecutableWitnessBefore                                                                        int      `json:"executable_witness_before"`
	RuntimeFallbackOnly                                                                            int      `json:"runtime_fallback_only"`
	MissingRegistryEdges                                                                           int      `json:"missing_registry_edges"`
	MissingDispatchEdges                                                                           int      `json:"missing_dispatch_edges"`
	MissingRecipeBindings                                                                          int      `json:"missing_recipe_bindings"`
	MissingRendererBindings                                                                        int      `json:"missing_renderer_bindings"`
	MissingHandlerBehaviors                                                                        int      `json:"missing_handler_behaviors"`
}

ExecutionPrimitiveMatrixAnalysis is the canonical R/S/M quotient. It is a registry/report plane only: R comes from structure execution contracts and S only from already proven DIRECT UAST paths.

func UniversalExecutionPrimitiveMatrixAnalysis added in v1.0.5

func UniversalExecutionPrimitiveMatrixAnalysis() (ExecutionPrimitiveMatrixAnalysis, error)

func WriteExecutionPrimitiveMatrixAnalysis added in v1.0.5

func WriteExecutionPrimitiveMatrixAnalysis(out string) (ExecutionPrimitiveMatrixAnalysis, error)

type Expr

type Expr interface {
	// contains filtered or unexported methods
}

type ExprStmt

type ExprStmt struct{ X Expr }

type ForStmt

type ForStmt struct {
	Name string
	Seq  Expr
	Body Stmt
}

type FrontendFactSink added in v1.0.5

type FrontendFactSink interface {
	AddNode(UniversalASTNode)
	AddField(FrontendFieldFact)
	AddSource(FrontendSourceFact)
	AddRole(FrontendRelationFact)
	AddOperand(FrontendRelationFact)
	AddSymbol(FrontendSymbolFact)
	AddBinding(FrontendRelationFact)
	AddRelation(FrontendRelationFact)
}

FrontendFactSink is the language-neutral output boundary for a parser core. It records only proved frontend facts; it never owns a second AST.

type FrontendFactsBuilder added in v1.0.5

type FrontendFactsBuilder struct{ Facts FrontendSemanticFacts }

FrontendFactsBuilder is the default in-memory sink used only until the shared facts-to-UAST builder consumes the collected frontend output.

func (*FrontendFactsBuilder) AddBinding added in v1.0.5

func (b *FrontendFactsBuilder) AddBinding(v FrontendRelationFact)

func (*FrontendFactsBuilder) AddField added in v1.0.5

func (b *FrontendFactsBuilder) AddField(v FrontendFieldFact)

func (*FrontendFactsBuilder) AddNode added in v1.0.5

func (b *FrontendFactsBuilder) AddNode(v UniversalASTNode)

func (*FrontendFactsBuilder) AddOperand added in v1.0.5

func (b *FrontendFactsBuilder) AddOperand(v FrontendRelationFact)

func (*FrontendFactsBuilder) AddRelation added in v1.0.5

func (b *FrontendFactsBuilder) AddRelation(v FrontendRelationFact)

func (*FrontendFactsBuilder) AddRole added in v1.0.5

func (*FrontendFactsBuilder) AddSource added in v1.0.5

func (b *FrontendFactsBuilder) AddSource(v FrontendSourceFact)

func (*FrontendFactsBuilder) AddSymbol added in v1.0.5

func (b *FrontendFactsBuilder) AddSymbol(v FrontendSymbolFact)

type FrontendFieldFact added in v1.0.5

type FrontendFieldFact struct {
	NodeID int
	Name   string
	Value  json.RawMessage
}

type FrontendRelationFact added in v1.0.5

type FrontendRelationFact struct {
	Kind        string
	From        int
	To          UniversalASTReference
	Role        string
	Ordinal     int
	EvidenceRef int
	Attributes  map[string]json.RawMessage
}

type FrontendReturnFact added in v1.0.5

type FrontendReturnFact struct {
	ReturnNodeID   int
	FunctionNodeID int
	ValueNodeID    int
	Type           SemanticType
}

type FrontendSemanticFacts added in v1.0.5

type FrontendSemanticFacts struct {
	SchemaVersion          int
	BasisSHA256            string
	SemanticDocumentSHA256 string
	LanguageProfile        string
	LanguageFacet          []float64
	Projection             string
	Evaluation             string
	ValueModel             string
	IndexBase              int
	Types                  SemanticTypeContract
	Origin                 SemanticOrigin
	Metadata               map[string]string
	Extensions             map[string]any
	Contracts              SemanticContracts
	Dialects               []SemanticDialect
	SemanticFeatures       *SemanticFeatureModel
	TypeTable              []SemanticTypeDefinition
	TypeGraph              matrixir.SparseMatrix
	TypeRelations          *SemanticTypeRelations

	Nodes     []UniversalASTNode
	Fields    []FrontendFieldFact
	Sources   []FrontendSourceFact
	TypesFact []FrontendTypeFact
	Symbols   []FrontendSymbolFact
	Bindings  []FrontendRelationFact
	Relations []FrontendRelationFact
	Returns   []FrontendReturnFact
	Evidence  SemanticEvidence

	// LanguageFacts is reserved for frontend-local, proved data. It is never
	// emitted unless it is represented by a permitted UAST field, facet or
	// relation above.
	LanguageFacts map[string]json.RawMessage
}

FrontendSemanticFacts is the short-lived, language-neutral hand-off from a frontend analyser to the Universal AST builder. It is deliberately not an intermediate representation: it contains only facts proved by one frontend and is discarded once the canonical UniversalASTDocument is built.

Nodes and relations use the public UAST schema types so that the schema, field-mask and relation-matrix validators remain the single authority.

type FrontendSourceFact added in v1.0.5

type FrontendSourceFact struct {
	NodeID int
	Span   SemanticSourceSpan
}

type FrontendSpec

type FrontendSpec struct {
	ID           string
	Aliases      []string
	Extensions   []string
	Capabilities []string
	Dialects     []string
}

FrontendSpec and BackendSpec are declarative registries. They keep language selection, aliases, file extensions, dialects and feature boundaries out of growing switch statements. Their implementation remains local Go code; no CrossTL source is included.

func Frontends

func Frontends() []FrontendSpec

type FrontendSymbolFact added in v1.0.5

type FrontendSymbolFact struct {
	NodeID int
	Name   string
	Kind   string
}

type FrontendTypeFact added in v1.0.5

type FrontendTypeFact struct {
	NodeID int
	Type   SemanticType
}

type FunctionExpr

type FunctionExpr struct {
	Binding           string
	DefaultEvaluation string
	Params            []Param
	Body              *BlockStmt
}

type FunctionFlowEvidence

type FunctionFlowEvidence struct {
	Name         string              `json:"name"`
	Entry        int                 `json:"entry"`
	Nodes        []string            `json:"nodes"`
	Always       matrixir.Matrix     `json:"always"`
	WhenTrue     matrixir.Matrix     `json:"when_true"`
	WhenFalse    matrixir.Matrix     `json:"when_false"`
	Reachable    matrixir.Vector     `json:"reachable"`
	Error        string              `json:"error,omitempty"`
	Cycles       matrixir.Vector     `json:"cycles"`
	StateMachine bool                `json:"state_machine"`
	Slots        []string            `json:"slots"`
	Reads        matrixir.Matrix     `json:"reads"`
	Writes       matrixir.Matrix     `json:"writes"`
	Defined      matrixir.Matrix     `json:"defined"`
	Initial      matrixir.Vector     `json:"initial"`
	Iterations   []IterationEvidence `json:"iterations,omitempty"`
}

FunctionFlowEvidence exposes the very matrices used by the generator, not a second graph reconstructed from emitted text. It is intended for audit tools.

func AnalyzeFunctionFlows

func AnalyzeFunctionFlows(canonical string) ([]FunctionFlowEvidence, error)

func AnalyzeSemanticFunctionFlows

func AnalyzeSemanticFunctionFlows(program *SemanticProgram) ([]FunctionFlowEvidence, error)

AnalyzeSemanticFunctionFlows is the canonical UAST flow entry point. The older string function above remains a compatibility adapter for callers that still have R text; no target generator needs that text as state.

type GoNativeFrontend added in v1.0.5

type GoNativeFrontend struct{}

GoNativeFrontend uses the official Go parser and type checker. Imports are rejected until an explicit, reproducible module resolver is supplied. Widths of platform-dependent int/uint/uintptr remain unknown, not host-derived.

func (GoNativeFrontend) Analyze added in v1.0.5

func (GoNativeFrontend) Analyze(filename, source string) (*NativeAnalysis, error)

type HelperRequirement added in v1.0.5

type HelperRequirement struct{ ID string }

type HelperSpec added in v1.0.5

type HelperSpec struct {
	ID, Target, RequiredCapability, Source string
	Dependencies                           []string
}

type IdentExpr

type IdentExpr struct{ Name string }

type IfStmt

type IfStmt struct {
	Cond Expr
	Then Stmt
	Else Stmt
}

type ImplementationMatrix added in v1.0.5

type ImplementationMatrix struct {
	Operations  []string              `json:"operations"`
	Stages      []string              `json:"stages"`
	Implemented matrixir.SparseMatrix `json:"implemented"`
	Unsupported matrixir.SparseMatrix `json:"unsupported"`
	Arity       matrixir.Vector       `json:"operand_count"`
	Results     []string              `json:"result_kinds"`
	Evidence    string                `json:"evidence_policy"`
	Languages   []string              `json:"languages"`
	Routes      matrixir.SparseMatrix `json:"declared_complete_operation_routes"`
}

ImplementationMatrix describes installed lowering paths, not test results. The operation basis and availability planes also gate actual code emission.

func TypedImplementationMatrix added in v1.0.5

func TypedImplementationMatrix() ImplementationMatrix

func (ImplementationMatrix) Check added in v1.0.5

func (m ImplementationMatrix) Check(required []string, stage string) error

func (ImplementationMatrix) Reject added in v1.0.5

func (m ImplementationMatrix) Reject(required []string) (matrixir.SparseMatrix, error)

type IndexExpr

type IndexExpr struct {
	X      Expr
	Args   []Arg
	Double bool
}

type IterationEvidence

type IterationEvidence struct {
	Sequence        string          `json:"sequence_slot"`
	Position        string          `json:"position_slot"`
	Length          string          `json:"length_slot"`
	Element         string          `json:"element_slot"`
	Advance         matrixir.Matrix `json:"advance"`
	InitialPosition float64         `json:"initial_position"`
}

type IterationExpr

type IterationExpr struct {
	Kind  string
	Value Expr
}

IterationExpr is an internal intrinsic, never resolved as a user function. Snapshot normalizes null/scalar/vector to a private outer vector; size then operates on that vector. Element gathers use the existing IndexExpr node.

type Language

type Language struct {
	ID        string
	Name      string
	Extension string
	Comment   string
}

func ByID

func ByID(id string) (Language, bool)

type LiteralExpr

type LiteralExpr struct{ Kind, Text string }

type NativeAnalysis added in v1.0.5

type NativeAnalysis struct {
	Schema                string                   `json:"schema"`
	Language              string                   `json:"language"`
	Executable            bool                     `json:"executable"`
	Events                []NativeEvent            `json:"events"`
	Syntax                matrixir.SparseMatrix    `json:"syntax"`
	Binding               matrixir.SparseMatrix    `json:"binding"`
	SameBinding           matrixir.SparseMatrix    `json:"same_binding"`
	Requirements          []string                 `json:"requirements"`
	Scopes                []SemanticScope          `json:"scopes"`
	ScopeMembership       matrixir.SparseMatrix    `json:"scope_membership"`
	TypeCheckArchitecture string                   `json:"type_check_architecture"`
	TypeTable             []SemanticTypeDefinition `json:"type_table"`
	TypeGraph             matrixir.SparseMatrix    `json:"type_graph"`
	TypeRelations         *SemanticTypeRelations   `json:"type_relations"`
}

NativeAnalysis is a frontend analysis artifact, NOT SemanticDocument v1. Syntax stores parent-to-child edges; Binding stores occurrences-to-symbols. The product Binding * Binding^T relates occurrences of the SAME symbol. It is not a dataflow or evaluation-order matrix.

type NativeEmissionInput added in v1.0.5

type NativeEmissionInput struct {
	NodeID   int
	Children []EmissionRecipeChild
}

NativeEmissionInput contains already-rendered UAST children. It is a transient layout input; semantic values remain in UniversalASTDocument.

type NativeEvent added in v1.0.5

type NativeEvent struct {
	ID           int                `json:"id"`
	Kind         string             `json:"kind"`
	Name         string             `json:"name,omitempty"`
	Literal      string             `json:"literal,omitempty"`
	Type         SemanticType       `json:"type"`
	Source       SemanticSourceSpan `json:"source"`
	Binding      *int               `json:"binding,omitempty"`
	Declaration  bool               `json:"declaration,omitempty"`
	Operation    string             `json:"operation,omitempty"`
	ShortCircuit bool               `json:"short_circuit,omitempty"`
	Confidence   string             `json:"confidence"`
	Scope        int                `json:"scope"`
}

type NativeFrontend added in v1.0.5

type NativeFrontend interface {
	Analyze(filename, source string) (*NativeAnalysis, error)
}

NativeFrontend extracts structured facts without reconstructing source text. Analysis is deliberately separate from executable lowering: a type-checked source construct is not automatically supported by the dynamic runtime.

type NativeGoEvidenceFact added in v1.0.5

type NativeGoEvidenceFact struct {
	NodeID       int
	Kind, Detail string
}

type NativeGoNodeFact added in v1.0.5

type NativeGoNodeFact struct {
	ID, Parent                                           int
	Kind, Name, Operator, LiteralKind, LiteralValue      string
	SourceID, TypeID, SymbolID                           int
	Children                                             []int
	Fields                                               map[string]string
	ParameterRefs, ArgumentRefs, OperandRefs, ReturnRefs []int
	CallTargetRef, FunctionRef, ScopeRef                 int
}

type NativeGoRelationFact added in v1.0.5

type NativeGoRelationFact struct {
	Kind        string
	From, To    int
	Role        string
	Ordinal     int
	EvidenceRef int
}

type NativeGoSemanticFacts added in v1.0.5

type NativeGoSemanticFacts struct {
	FrontendSemanticFacts
	Root                                                                       *SemanticStatement
	Structure, Fields, Sources, Types, Symbols, Calls, Control, Data, Evidence int
	SourceFacts                                                                []NativeGoSourceFact
	TypeFacts                                                                  []NativeGoTypeFact
	SymbolFacts                                                                []NativeGoSymbolFact
	BindingFacts                                                               []NativeGoRelationFact
	RelationFacts                                                              []NativeGoRelationFact
	EvidenceFacts                                                              []NativeGoEvidenceFact
	Nodes                                                                      []NativeGoNodeFact
	RawUAST                                                                    *UniversalASTDocument
}

NativeGoSemanticFacts are short-lived frontend facts shared by lowering adapters. They are not a second IR and are discarded after construction.

type NativeGoSourceFact added in v1.0.5

type NativeGoSourceFact struct {
	ID   int
	Span SemanticSourceSpan
}

type NativeGoSymbolFact added in v1.0.5

type NativeGoSymbolFact struct {
	ID         int
	Name, Kind string
}

type NativeGoTypeFact added in v1.0.5

type NativeGoTypeFact struct {
	ID   int
	Type SemanticType
}

type NextStmt

type NextStmt struct{}

type OperationExpr added in v1.0.5

type OperationExpr struct {
	Operation SemanticOperation
	Operands  []Expr
}

type Param

type Param struct {
	Mode    string
	Name    string
	Default Expr
	Type    *SemanticType // exact executable parameter type; nil is legacy dynamic
}

type ParsedNode added in v1.0.5

type ParsedNode struct {
	ID     int
	Kind   string
	Source *SemanticSourceSpan
}

type PreservationMode added in v1.0.5

type PreservationMode string
const (
	PreservationDirect  PreservationMode = "DIRECT"
	PreservationRewrite PreservationMode = "REWRITE"
	PreservationHelper  PreservationMode = "HELPER"
	PreservationEmulate PreservationMode = "EMULATE"
	PreservationRuntime PreservationMode = "RUNTIME"
	// PreservationError is an explicit semantic refusal.  It is deliberately
	// distinct from an absent matrix entry: every target × UASF cell must have
	// a deterministic result.
	PreservationError PreservationMode = "ERROR"
)

type PreservationRegistry added in v1.0.5

type PreservationRegistry struct{ Rules []PreservationRule }

func DefaultPreservationRegistry added in v1.0.5

func DefaultPreservationRegistry() PreservationRegistry

func (PreservationRegistry) Solve added in v1.0.5

func (r PreservationRegistry) Solve(target, capability string) (PreservationRule, bool)

type PreservationRule added in v1.0.5

type PreservationRule struct {
	Capability, Target          string
	Mode                        PreservationMode
	Preconditions, Requirements []string
	Handler, Test               string
}

type PrimitiveSpec

type PrimitiveSpec struct {
	TableIndex string
	Name       string
	Kernel     string
	Arity      string
}

func PrimitiveRoute

func PrimitiveRoute(target, name string) (PrimitiveSpec, bool)

type ProductPathWitness added in v1.0.5

type ProductPathWitness struct{ Target, Primitive, Status, MissingFactor string }

ProductPathWitness is the matrix-derived reachability result for one target/primitive pair. It contains registry reachability only and never promotes a runtime terminal into native code.

type ProjectionDerivationRule added in v1.0.5

type ProjectionDerivationRule struct {
	ID        string
	Input     string
	Output    string
	Transform string
}

ProjectionDerivationRule is a declarative typed transform over existing UAST/schema information. It is not a semantic IR and cannot create a new semantic fact; it only exposes a proved projection input.

type ProjectionGapInformation added in v1.0.5

type ProjectionGapInformation struct {
	GapID                 string
	ProjectionPrimitive   string
	RequiredInformation   string
	Class                 ProjectionGapInformationClass
	ExistingUASTElement   string
	DerivationRule        string
	TargetSyntaxParameter string
	SemanticGapID         string
	EvidenceSource        string
	Conflict              bool
}

type ProjectionGapInformationAnalysis added in v1.0.5

type ProjectionGapInformationAnalysis struct {
	Rows   []ProjectionGapInformation
	Counts map[ProjectionGapInformationClass]int
}

func UniversalProjectionGapInformationAnalysis added in v1.0.5

func UniversalProjectionGapInformationAnalysis() (ProjectionGapInformationAnalysis, error)

UniversalProjectionGapInformationAnalysis classifies every remaining primitive obligation. The matrix is the proof boundary for any future UAST expansion: a schema mutation is impossible unless a D row is present.

func WriteProjectionGapInformationAnalysis added in v1.0.5

func WriteProjectionGapInformationAnalysis(dir string) (ProjectionGapInformationAnalysis, error)

type ProjectionGapInformationClass added in v1.0.5

type ProjectionGapInformationClass string

ProjectionGapInformationClass separates UAST facts from their projection consumption. Only class D is allowed to request an additive schema change.

const (
	ProjectionInfoAlready   ProjectionGapInformationClass = "A_ALREADY_IN_UAST"
	ProjectionInfoDerivable ProjectionGapInformationClass = "B_DERIVABLE"
	ProjectionInfoSyntax    ProjectionGapInformationClass = "C_TARGET_SYNTAX"
	ProjectionInfoSemantic  ProjectionGapInformationClass = "D_TRUE_UAST_SEMANTIC_GAP"
)

type ProjectionInformationIntegration added in v1.0.5

type ProjectionInformationIntegration struct {
	DirectBindings               []ProjectionGapInformation
	Derivations                  []ProjectionDerivationRule
	Syntax                       []ProjectionGapInformation
	PrimitiveInformationComplete map[string]bool
	PrimitiveEmissionComplete    map[string]bool
	DerivationClasses            []string
	TargetSyntaxCapabilities     []string
}

func UniversalProjectionInformationIntegration added in v1.0.5

func UniversalProjectionInformationIntegration() (ProjectionInformationIntegration, error)

UniversalProjectionInformationIntegration compiles A/B/C into projection data. The separate EmissionComplete bit is essential: information being available never pretends that a missing syntax combinator exists.

func WriteProjectionInformationIntegration added in v1.0.5

func WriteProjectionInformationIntegration(dir string) (ProjectionInformationIntegration, error)

type ProjectionObligationAnalysis added in v1.0.5

type ProjectionObligationAnalysis struct {
	Archetypes   []string
	Obligations  []string
	Primitives   []ProjectionObligationPrimitive
	Requirements map[string]map[string]bool // M_AO
}

ProjectionObligationAnalysis is a declarative factorization of the residual renderer contracts. It contains no AST values and is not another IR: it is the checked, boolean requirement table consumed by TargetSpec/renderer registration.

func UniversalProjectionObligationAnalysis added in v1.0.5

func UniversalProjectionObligationAnalysis() (ProjectionObligationAnalysis, error)

UniversalProjectionObligationAnalysis returns the immutable, exact matrix quotient cached for this process. All consumers therefore use the same minimum primitive basis and do not repeat the exponential cover search.

func WriteProjectionObligationAnalysis added in v1.0.5

func WriteProjectionObligationAnalysis(dir string) (ProjectionObligationAnalysis, error)

WriteProjectionObligationAnalysis exports the factor matrices. These are declarative registries used for deterministic renderer composition.

func (ProjectionObligationAnalysis) ValidateExact added in v1.0.5

func (a ProjectionObligationAnalysis) ValidateExact() error

ValidateExact proves M_AO = M_AP odot M_PO. It rejects both added and lost cells, protecting the projection contract against accidental broadening.

type ProjectionObligationPrimitive added in v1.0.5

type ProjectionObligationPrimitive struct {
	ID          string
	Archetypes  []string
	Obligations []string
}

ProjectionObligationPrimitive represents one formal concept (a complete rectangle of true cells). Its extent is M_AP and its intent is M_PO.

type ProjectionPrimitiveReduction added in v1.0.5

type ProjectionPrimitiveReduction struct {
	Before            int
	Primitives        []ProjectionObligationPrimitive
	DuplicatesRemoved int
	Compositions      map[string][]string
	ExistingRenderers map[string][]string
	TargetSpecOnly    map[string]bool
	Rewrite           map[string][]string
	Helpers           map[string][]string
	Runtime           map[string][]string
	Irreducible       []string
}

ProjectionPrimitiveReduction is the proof-oriented residual reduction for the renderer primitive basis. It is a registry calculation, not an IR.

func UniversalProjectionPrimitiveReduction added in v1.0.5

func UniversalProjectionPrimitiveReduction() (ProjectionPrimitiveReduction, error)

UniversalProjectionPrimitiveReduction applies duplicate elimination, exact primitive composition and every currently registered positive path. A legacy renderer is never a positive match: it may appear in audit reports, but only direct UAST renderer bindings can cover a primitive.

func WriteProjectionPrimitiveReduction added in v1.0.5

func WriteProjectionPrimitiveReduction(dir string) (ProjectionPrimitiveReduction, error)

type ProjectionPrimitiveTargetSupport added in v1.0.5

type ProjectionPrimitiveTargetSupport struct {
	Target     string
	Primitive  string
	Available  bool
	Mode       PreservationMode
	Parameters map[string]string
}

ProjectionPrimitiveTargetSupport is M_TP plus the target parameters used by the syntax-only composition. A target is marked available only if it has a registered direct UAST renderer for the primitive; parameters alone never upgrade an unsupported semantic contract.

func ProjectionPrimitiveTargetSupports added in v1.0.5

func ProjectionPrimitiveTargetSupports(analysis ProjectionObligationAnalysis) ([]ProjectionPrimitiveTargetSupport, error)

ProjectionPrimitiveTargetSupports derives M_TP directly from TargetSpec. Residual primitives intentionally remain ERROR until a generic direct UAST renderer registers their form. This makes the next implementation step a small primitive registration rather than a Target×UASF special case.

type ProjectionRendererArchetype added in v1.0.5

type ProjectionRendererArchetype struct {
	ID                string   `json:"id"`
	ProjectionClasses []string `json:"projection_classes"`
	Signature         string   `json:"signature"`
	ExistingRenderers []string `json:"existing_renderers"`
	Implemented       bool     `json:"implemented"`
}

type ProjectionRendererBinding added in v1.0.5

type ProjectionRendererBinding struct {
	Form       string
	RendererID string
	SourceFile string
	Function   string
	Reusable   bool
}

type ProjectionRendererCatalogEntry added in v1.0.5

type ProjectionRendererCatalogEntry struct {
	RendererID         string   `json:"renderer_id"`
	SourceFile         string   `json:"source_file"`
	SourceFunction     string   `json:"source_function"`
	SyntacticCategory  string   `json:"syntactic_category"`
	RequiredChildren   []string `json:"required_children"`
	RequiredFields     []string `json:"required_fields"`
	RequiredRelations  []string `json:"required_relations"`
	TargetScope        string   `json:"target_scope"`
	ReturnsDocOrSource string   `json:"returns_doc_or_source"`
	Reusable           bool     `json:"reusable"`
}

ProjectionRendererCatalogEntry records a renderer's syntax interface. It is harvested from Go source and remains declarative: no AST node or semantic value is copied into the catalog.

func HarvestProjectionRenderers added in v1.0.5

func HarvestProjectionRenderers() ([]ProjectionRendererCatalogEntry, error)

HarvestProjectionRenderers parses the checked-in renderer sources. A legacy renderer is catalogued for auditability but is marked non-reusable unless it consumes the UAST execution graph directly.

type ProjectionRendererComposition added in v1.0.5

type ProjectionRendererComposition struct {
	ArchetypeID string
	Primitives  []string
}

ProjectionRendererComposition is the generated, syntax-only sequence for a renderer archetype. It is a registry entry rather than another program IR: nodes and semantic values are still read directly from UniversalASTDocument.

func GeneratedProjectionRendererCompositions added in v1.0.5

func GeneratedProjectionRendererCompositions() ([]ProjectionRendererComposition, error)

GeneratedProjectionRendererCompositions is derived from the exact boolean factorization M_AO = M_AP odot M_PO. It makes later renderer additions a primitive registration: all archetype compositions update at once.

type ProjectionRendererHarvest added in v1.0.5

type ProjectionRendererHarvest struct {
	Catalog     []ProjectionRendererCatalogEntry `json:"catalog"`
	Archetypes  []ProjectionRendererArchetype    `json:"archetypes"`
	Assignments map[string]string                `json:"class_to_archetype"`
	Matches     []ProjectionRendererMatch        `json:"matches"`
}

func UniversalProjectionRendererHarvest added in v1.0.5

func UniversalProjectionRendererHarvest() (ProjectionRendererHarvest, error)

UniversalProjectionRendererHarvest constructs the exact quotient of the remaining projection classes by renderer requirements.

func WriteProjectionRendererHarvest added in v1.0.5

func WriteProjectionRendererHarvest(dir string) (ProjectionRendererHarvest, error)

type ProjectionRendererMatch added in v1.0.5

type ProjectionRendererMatch struct {
	ArchetypeID string `json:"archetype_id"`
	RendererID  string `json:"renderer_id"`
	Compatible  bool   `json:"compatible"`
}

ProjectionRendererMatch is one cell of M_AR. A true cell means that the renderer's checked-in UAST syntax contract supplies every requirement of the archetype. Partial matches never authorize a projection.

type ProjectionResidualAnalysis added in v1.0.5

type ProjectionResidualAnalysis struct {
	Targets         []string
	Archetypes      []string
	Primitives      []string
	Rows            []ProjectionResidualCell
	Classes         []ProjectionResidualClass
	ColumnGapCounts map[string]int
	PrimitiveImpact map[string]int
	SetCounts       map[string]int
}

ProjectionResidualAnalysis is the exact residual plane used to select the next common renderer contract. PrimitiveImpact counts only rows whose complete residual would become empty if the primitive (or exact set) were supported; it does not count partial improvements.

func UniversalProjectionResidualAnalysis added in v1.0.5

func UniversalProjectionResidualAnalysis() (ProjectionResidualAnalysis, error)

UniversalProjectionResidualAnalysis computes M_RESIDUAL directly from the existing renderer composition and target syntax matrices. The synthetic form:<projection-form> atoms are syntax obligations, not new UAST structures; they expose exactly which generic form contract is absent.

func WriteProjectionResidualAnalysis added in v1.0.5

func WriteProjectionResidualAnalysis(dir string) (ProjectionResidualAnalysis, error)

WriteProjectionResidualAnalysis emits the residual quotient and exact column/impact tables consumed by the next generic projection iteration.

type ProjectionResidualCell added in v1.0.5

type ProjectionResidualCell struct {
	Target             string
	Archetype          string
	RequiredPrimitives []string
	Supported          []string
	Missing            []string
	AffectedUASFCells  int
}

ProjectionResidualCell is one exact Target × renderer-archetype row. It contains no program data; it is the boolean residual of the existing renderer obligation matrix against the target syntax/template matrix.

type ProjectionResidualClass added in v1.0.5

type ProjectionResidualClass struct {
	ID                string
	MemberCount       int
	Targets           []string
	Archetypes        []string
	MissingPrimitives []string
	AffectedUASFCells int
}

ProjectionResidualClass groups rows only when their missing primitive vector is byte-for-byte identical after sorting. Similarity and heuristic scores are deliberately not used.

type RepeatStmt

type RepeatStmt struct{ Body Stmt }

type RequiredSemantics added in v1.0.5

type RequiredSemantics struct{ Structures, Relations, Facets, Fields []string }

func RequiredSemanticsFromUAST added in v1.0.5

func RequiredSemanticsFromUAST(u *UniversalASTDocument) RequiredSemantics

RequiredSemanticsFromUAST reads the canonical graph without source-language provenance or a legacy compatibility view.

type Requirement added in v1.0.5

type Requirement struct {
	ID                   string
	Kind                 RequirementKind
	Target               string
	Dependencies         []string
	Preconditions, Tests []string
	Emit                 string
}

type RequirementKind added in v1.0.5

type RequirementKind string
const (
	RequirementImport    RequirementKind = "IMPORT"
	RequirementHelper    RequirementKind = "HELPER"
	RequirementEmulation RequirementKind = "EMULATION"
	RequirementRuntime   RequirementKind = "RUNTIME"
)

type RequirementRegistry added in v1.0.5

type RequirementRegistry struct{ Rules map[string]Requirement }

func DefaultRequirementRegistry added in v1.0.5

func DefaultRequirementRegistry() RequirementRegistry

func (RequirementRegistry) Resolve added in v1.0.5

func (r RequirementRegistry) Resolve(ids []string) ([]Requirement, error)

type ReturnStmt

type ReturnStmt struct{ X Expr }

type RuntimeModule added in v1.0.5

type RuntimeModule struct {
	ID, Target                                                        string
	ProvidedCapabilities, RequiredCapabilities, Dependencies, Imports []string
	Emit                                                              Doc
	Tests                                                             []string
}

RuntimeModule is a modular, source-independent target support declaration. It is registered as a normal RUNTIME requirement and is emitted only when a preservation rule explicitly requests one.

type RuntimeModuleRegistry added in v1.0.5

type RuntimeModuleRegistry struct{ Modules map[string]RuntimeModule }

func (RuntimeModuleRegistry) Provides added in v1.0.5

func (r RuntimeModuleRegistry) Provides(target, capability string) bool

func (RuntimeModuleRegistry) RequirementRegistry added in v1.0.5

func (r RuntimeModuleRegistry) RequirementRegistry() RequirementRegistry

type RuntimePromotionAnalysis added in v1.0.5

type RuntimePromotionAnalysis struct {
	Schema                 string                         `json:"schema"`
	Targets                []string                       `json:"targets"`
	ProjectionClasses      []string                       `json:"projection_classes"`
	RuntimeUASF            [][]string                     `json:"runtime_uasf"`
	RuntimeProjectionClass map[string]map[string]bool     `json:"runtime_projection_classes"`
	DirectProjectionClass  map[string]map[string]bool     `json:"direct_projection_classes"`
	Residual               map[string]map[string][]string `json:"direct_residual"`
	Promotable             map[string]map[string]bool     `json:"promotable"`
}

RuntimePromotionAnalysis is a report/registry view over the existing target×UASF preservation matrix. It is deliberately not an IR: it records which runtime cells have a complete direct projection contract and which obligations still prevent promotion.

func UniversalRuntimePromotionAnalysis added in v1.0.5

func UniversalRuntimePromotionAnalysis() (RuntimePromotionAnalysis, error)

UniversalRuntimePromotionAnalysis derives M_RU and M_RP directly from the current preservation and projection-class matrices. A cell is promotable only when the class has a direct syntax contract and no residual obligation.

func WriteRuntimePromotionAnalysis added in v1.0.5

func WriteRuntimePromotionAnalysis(dir string) (RuntimePromotionAnalysis, error)

WriteRuntimePromotionAnalysis persists the matrix views used by the next evidence-mining round. Existing runtime support remains untouched.

type RuntimePromotionEvidence added in v1.0.5

type RuntimePromotionEvidence struct {
	Source, Target, ProjectionClass, UASF, SourceID, Package, SourceHash string
}

RuntimePromotionEvidence is an observational record. It is deliberately separate from UAST semantics and cannot promote a target capability by itself. Proof rows are added only by the existing roundtrip/compiler/runtime test gates.

type RuntimePromotionEvidenceSummary added in v1.0.5

type RuntimePromotionEvidenceSummary struct {
	Schema                   string `json:"schema"`
	SourceRecordsRead        int    `json:"source_records_read"`
	RelevantRuntimeMatches   int    `json:"relevant_runtime_matches"`
	DirectCandidates         int    `json:"direct_candidates"`
	NoDirectCandidate        int    `json:"no_direct_candidate"`
	NewProvenDirectContracts int    `json:"new_proven_direct_contracts"`
	RuntimeCellsPromoted     int    `json:"runtime_cells_promoted"`
	MLCPDRows                int    `json:"mlcpd_rows"`
	EcosystemPackages        int    `json:"ecosystem_packages"`
	CrossSourceConfirmed     int    `json:"cross_source_confirmed"`
	EmpiricalSemanticProven  int    `json:"empirical_semantic_proven"`
	Rejected                 int    `json:"rejected"`
	Conflicts                int    `json:"conflicts"`
	DirectBefore             int    `json:"direct_before"`
	RuntimeBefore            int    `json:"runtime_before"`
	DirectAfter              int    `json:"direct_after"`
	RuntimeAfter             int    `json:"runtime_after"`
	MLCPDInputState          string `json:"mlcpd_input_state"`
}

func WriteRuntimePromotionEvidence added in v1.0.5

func WriteRuntimePromotionEvidence(out, ecosystemProvenance, ecosystemArtifacts string) (RuntimePromotionEvidenceSummary, error)

WriteRuntimePromotionEvidence imports only source-free evidence emitted by the ecosystem miner. Native observations are filtered through the current runtime matrix and projected with the existing UAST crosswalk. They remain candidates until a semantic roundtrip and/or runtime differential test proves the direct contract.

type RuntimeTaintCell added in v1.0.6

type RuntimeTaintCell struct {
	Target, Fixture, Primitive, NativeError, RuntimeError, SyntaxFailure   string
	NativeReached, PureNative, RuntimeFallback, SyntaxChecked, SyntaxValid bool
	TaintArtifacts                                                         []string
}

RuntimeTaintCell records the real two-stage result for one target and one emitted fixture: native first, then the private compatibility fallback.

func AnalyzeRuntimeTaintMatrix added in v1.0.6

func AnalyzeRuntimeTaintMatrix(fixtures []RuntimeTaintFixture) ([]RuntimeTaintCell, error)

AnalyzeRuntimeTaintMatrix obtains its observations from final emitted target source. It never turns an unchecked toolchain, a registry label, or an unavailable native route into a positive direct claim.

func WriteRuntimeTaintMatrix added in v1.0.6

func WriteRuntimeTaintMatrix(out string) ([]RuntimeTaintCell, error)

WriteRuntimeTaintMatrix writes observations, not capability declarations.

type RuntimeTaintFixture added in v1.0.6

type RuntimeTaintFixture struct {
	ID, Source string
	Primitives []string
}

RuntimeTaintFixture is one real, minimal program context. It is deliberately limited to syntax-emitting primitives; metadata, proof and validation-only primitives never receive invented source fixtures.

func DefaultRuntimeTaintFixtures added in v1.0.6

func DefaultRuntimeTaintFixtures() []RuntimeTaintFixture

DefaultRuntimeTaintFixtures covers the executable emission basis rather than manufacturing 28 language snippets. The primitive labels come from the existing syntax structure contracts.

type RuntimeTaintReport added in v1.0.6

type RuntimeTaintReport struct {
	Artifacts []string `json:"artifacts"`
}

RuntimeTaintReport is an observation of generated target source. It is not an IR and carries no program semantics: it records only whether a final target document reaches a known compatibility-runtime artifact.

func AnalyzeRuntimeTaint added in v1.0.6

func AnalyzeRuntimeTaint(source string, helperIDs []string) RuntimeTaintReport

AnalyzeRuntimeTaint is the final-source half of the runtime-taint matrix. A native UAST result is accepted only when this report is empty. The same detector is used before entering the explicit compatibility fallback.

func (RuntimeTaintReport) Tainted added in v1.0.6

func (r RuntimeTaintReport) Tainted() bool

type SemanticArgument

type SemanticArgument struct {
	Name    string              `json:"name,omitempty"`
	Missing bool                `json:"missing,omitempty"`
	Value   *SemanticExpression `json:"value,omitempty"`
}

type SemanticBinding

type SemanticBinding struct {
	ID         int    `json:"id"`
	Name       string `json:"name"`
	Scope      int    `json:"scope"`
	Mutable    bool   `json:"mutable"`
	Definition int    `json:"definition"`
	TypeOrigin string `json:"type_origin"`
}

type SemanticCallCandidate added in v1.0.5

type SemanticCallCandidate struct {
	Name        string       `json:"name"`
	Declaration string       `json:"declaration"`
	Type        SemanticType `json:"type,omitempty"`
}

type SemanticCallResolution added in v1.0.5

type SemanticCallResolution struct {
	Candidates     []SemanticCallCandidate `json:"candidates"`
	Obligations    []string                `json:"obligations"`
	Required       matrixir.Matrix         `json:"required"`
	Satisfied      matrixir.Matrix         `json:"satisfied"`
	ConversionCost matrixir.Matrix         `json:"conversion_cost"`
	Priority       []float64               `json:"priority"`
	Selected       *int                    `json:"selected"`
}

SemanticCallResolution records frontend overload/binder output as matrices. Rows are candidates; Required and Satisfied columns are obligations, while ConversionCost columns correspond to call arguments. Selected is accepted only when it is the unique lexicographic minimum derived from these planes.

type SemanticContracts

type SemanticContracts struct {
	Requires   []string `json:"requires,omitempty"`
	Ensures    []string `json:"ensures,omitempty"`
	Invariants []string `json:"invariants,omitempty"`
}

SemanticContracts state assertions made by a producer. They are data, not executable checks: backends must reject contracts they cannot preserve.

type SemanticDialect

type SemanticDialect struct {
	Name         string                     `json:"name"`
	Capabilities []string                   `json:"capabilities"`
	Operations   []SemanticDialectOperation `json:"operations"`
}

SemanticDialect keeps specialist domains out of the universal core. A backend may emit it only after declaring every required capability.

type SemanticDialectOperation

type SemanticDialectOperation struct {
	ID         string         `json:"id"`
	Kind       string         `json:"kind"`
	Attributes map[string]any `json:"attributes,omitempty"`
}

type SemanticDocument

type SemanticDocument struct {
	SchemaVersion    int                      `json:"schema_version"`
	Schema           string                   `json:"schema"`
	Evaluation       string                   `json:"evaluation"`
	ValueModel       string                   `json:"value_model"`
	IndexBase        int                      `json:"index_base"`
	Types            SemanticTypeContract     `json:"type_contract"`
	Origin           SemanticOrigin           `json:"origin"`
	Metadata         map[string]string        `json:"metadata,omitempty"`
	Extensions       map[string]any           `json:"extensions,omitempty"`
	Contracts        SemanticContracts        `json:"contracts,omitempty"`
	Dialects         []SemanticDialect        `json:"dialects,omitempty"`
	SemanticFeatures *SemanticFeatureModel    `json:"semantic_features,omitempty"`
	UniversalAST     *UniversalASTDocument    `json:"universal_ast,omitempty"`
	TypeTable        []SemanticTypeDefinition `json:"type_table,omitempty"`
	TypeGraph        matrixir.SparseMatrix    `json:"type_graph,omitempty"`
	TypeRelations    *SemanticTypeRelations   `json:"type_relations,omitempty"`
	Root             SemanticStatement        `json:"root"`
	Evidence         SemanticEvidence         `json:"evidence"`
}

func SemanticDocumentFromUniversalAST added in v1.0.5

func SemanticDocumentFromUniversalAST(u *UniversalASTDocument) (SemanticDocument, error)

SemanticDocumentFromUniversalAST is lossless for the currently executable SemanticDocument projection. Pure UAST nodes outside that projection remain representable but are rejected instead of being approximated.

func (SemanticDocument) MarshalJSON added in v1.0.5

func (doc SemanticDocument) MarshalJSON() ([]byte, error)

type SemanticEffectSummary

type SemanticEffectSummary struct {
	Counts           map[string]int `json:"counts"`
	ConservativePure bool           `json:"conservative_pure"`
	Unknown          bool           `json:"unknown"`
}

SemanticEffectSummary is computed from the effect matrix. ConservativePure becomes true only when every observed effect is proven non-observable.

func SummarizeEffects

func SummarizeEffects(program *SemanticProgram) SemanticEffectSummary

type SemanticEvidence

type SemanticEvidence struct {
	Nodes        []SemanticNode        `json:"nodes"`
	TypeAxes     []string              `json:"type_axes"`
	EffectAxes   []string              `json:"effect_axes"`
	Types        matrixir.SparseMatrix `json:"types"`
	Effects      matrixir.SparseMatrix `json:"effects"`
	Syntax       matrixir.SparseMatrix `json:"syntax"`
	Control      matrixir.SparseMatrix `json:"control"`
	Data         matrixir.SparseMatrix `json:"data"`
	Binding      matrixir.SparseMatrix `json:"binding"`
	Order        matrixir.SparseMatrix `json:"evaluation_order"`
	CallModes    matrixir.SparseMatrix `json:"call_modes"`
	CallModeAxes []string              `json:"call_mode_axes"`
	Scope        matrixir.SparseMatrix `json:"scope_membership"`
	Scopes       []SemanticScope       `json:"scopes"`
	Bindings     []SemanticBinding     `json:"bindings"`
	Contract     matrixir.Vector       `json:"contract"`
	ContractAxes []string              `json:"contract_axes"`
}

func AnalyzeUniversalEvidence added in v1.0.5

func AnalyzeUniversalEvidence(u *UniversalASTDocument) (SemanticEvidence, error)

AnalyzeUniversalEvidence derives executable evidence exclusively from the canonical UAST graph. It is shared by direct frontends and never traverses a legacy Stmt or Expr tree.

type SemanticExpression

type SemanticExpression struct {
	Operation   *SemanticOperation      `json:"typed_operation,omitempty"`
	ID          int                     `json:"id"`
	Kind        string                  `json:"kind"`
	Scope       int                     `json:"scope"`
	Type        SemanticType            `json:"type,omitempty"`
	TypeOrigin  string                  `json:"type_origin,omitempty"`
	Semantics   SemanticSemantics       `json:"semantics,omitempty"`
	Effects     []string                `json:"effects,omitempty"`
	Binding     *int                    `json:"binding,omitempty"`
	Source      *SemanticSourceSpan     `json:"source,omitempty"`
	Attributes  map[string]any          `json:"attributes,omitempty"`
	Extensions  map[string]any          `json:"extensions,omitempty"`
	Name        string                  `json:"name,omitempty"`
	Operator    string                  `json:"operator,omitempty"`
	LiteralKind string                  `json:"literal_kind,omitempty"`
	Text        string                  `json:"text,omitempty"`
	Left        *SemanticExpression     `json:"left,omitempty"`
	Right       *SemanticExpression     `json:"right,omitempty"`
	Value       *SemanticExpression     `json:"value,omitempty"`
	Function    *SemanticFunction       `json:"function,omitempty"`
	Arguments   []SemanticArgument      `json:"arguments,omitempty"`
	Resolution  *SemanticCallResolution `json:"call_resolution,omitempty"`
	DoubleIndex bool                    `json:"double_index,omitempty"`
}

type SemanticFeatureBasis added in v1.0.5

type SemanticFeatureBasis struct {
	Schema                 string            `json:"schema"`
	Languages              []string          `json:"languages"`
	Features               []string          `json:"features"`
	LanguageFeature        matrixir.Matrix   `json:"language_feature"`
	DialectFeatures        []string          `json:"dialect_features"`
	LanguageDialectFeature matrixir.Matrix   `json:"language_dialect_feature"`
	DialectObserved        matrixir.Vector   `json:"dialect_observed"`
	NodeKinds              []string          `json:"node_kinds"`
	FeatureNode            matrixir.Matrix   `json:"feature_node"`
	RelationKinds          []string          `json:"relation_kinds"`
	FeatureRelation        matrixir.Matrix   `json:"feature_relation"`
	Provenance             map[string]string `json:"provenance"`
}

type SemanticFeatureModel added in v1.0.5

type SemanticFeatureModel struct {
	BasisSHA256       string               `json:"basis_sha256"`
	Basis             SemanticFeatureBasis `json:"basis"`
	ProfileLanguage   string               `json:"profile_language"`
	LanguageSelection matrixir.Vector      `json:"language_selection"`
	FeatureDemand     matrixir.Vector      `json:"feature_demand"`
	DialectDemand     matrixir.Vector      `json:"dialect_demand"`
	NodeDemand        matrixir.Vector      `json:"node_demand"`
	RelationDemand    matrixir.Vector      `json:"relation_demand"`
}

SemanticFeatureModel makes the complete supplied eight-language feature space part of SemanticProgram. All derived vectors are matrix products and are validated on every interchange boundary.

type SemanticField

type SemanticField struct {
	Name string       `json:"name"`
	Type SemanticType `json:"type"`
}

type SemanticFunction

type SemanticFunction struct {
	Binding           string              `json:"binding,omitempty"`
	DefaultEvaluation string              `json:"default_evaluation,omitempty"`
	Parameters        []SemanticParameter `json:"parameters"`
	Body              SemanticStatement   `json:"body"`
}

type SemanticNode

type SemanticNode struct {
	ID     int    `json:"id"`
	Kind   string `json:"kind"`
	Symbol string `json:"symbol,omitempty"`
	Scope  int    `json:"scope"`
}

type SemanticNominalRelations added in v1.0.5

type SemanticNominalRelations struct {
	Identities  []string              `json:"identities"`
	Definitions matrixir.SparseMatrix `json:"definitions"`
	References  matrixir.SparseMatrix `json:"references"`
	Resolution  matrixir.SparseMatrix `json:"resolution"`
	Unresolved  []int                 `json:"unresolved"`
}

Identity columns group views of the same nominal declaration/instantiation. Resolution links a finite reference to all captured definition views of that identity. It is not structural equivalence, assignability or alias erasure.

type SemanticObservation

type SemanticObservation struct {
	Stdout  string                `json:"stdout"`
	Error   string                `json:"error,omitempty"`
	Effects SemanticEffectSummary `json:"effects"`
}

SemanticObservation is the deterministic observation available from the embedded semantic runtime. External native tests may extend this with files, state snapshots and process exit information.

func ObserveSemantic

func ObserveSemantic(program *SemanticProgram) SemanticObservation

type SemanticOperation added in v1.0.5

type SemanticOperation struct {
	Name string       `json:"name"`
	Type SemanticType `json:"type"`
	Text string       `json:"text,omitempty"`
}

SemanticOperation is a typed core operation, independent of source spelling. Type is the integer domain; comparison/format operations return bool/string.

type SemanticOrigin

type SemanticOrigin struct {
	SourceLanguage string   `json:"source_language"`
	SourceVersion  string   `json:"source_version,omitempty"`
	EntryPoint     string   `json:"entry_point"`
	Modules        []string `json:"modules"`
}

type SemanticParameter

type SemanticParameter struct {
	Mode    string              `json:"mode,omitempty"`
	ID      int                 `json:"id"`
	Name    string              `json:"name"`
	Type    SemanticType        `json:"type,omitempty"`
	Passing string              `json:"passing,omitempty"`
	Default *SemanticExpression `json:"default,omitempty"`
}

type SemanticParameterVisitor

type SemanticParameterVisitor interface {
	EnterParameter(*SemanticParameter) error
}

type SemanticProgram

type SemanticProgram struct {
	Body             *BlockStmt            `json:"-"`
	Evaluation       string                `json:"evaluation"`
	ValueModel       string                `json:"value_model"`
	IndexBase        int                   `json:"index_base"`
	Types            SemanticTypeContract  `json:"type_contract"`
	Origin           SemanticOrigin        `json:"origin"`
	Metadata         map[string]string     `json:"metadata,omitempty"`
	Extensions       map[string]any        `json:"extensions,omitempty"`
	Contracts        SemanticContracts     `json:"contracts,omitempty"`
	Dialects         []SemanticDialect     `json:"dialects,omitempty"`
	SemanticFeatures *SemanticFeatureModel `json:"semantic_features,omitempty"`
	UniversalAST     *UniversalASTDocument `json:"universal_ast,omitempty"`
	Evidence         SemanticEvidence      `json:"evidence"`
	// contains filtered or unexported fields
}

SemanticProgram owns the executable tree. Canonical R is now a diagnostic serialization, not the carrier of evaluation semantics. Legacy values retain the binary64 contract; typed operations use an explicit exact-scalar contract and integer-width domains. Unknown types/effects remain explicit in matrices.

func DecodeGenerated

func DecodeGenerated(source, code string) (*SemanticProgram, bool, error)

DecodeGenerated reads the actual emitted program. Only an exact known runtime prefix may be removed; every remaining token must be decoded and reproduced. There is no original-source payload, comment recovery or cache. The shared emitter functions define the inverse operation templates.

func LowerMatrixActions

func LowerMatrixActions(source string, nodes []matrixir.CanonicalNode) (*SemanticProgram, error)

LowerMatrixActions is the common-subset frontend boundary. MatrixIR has already recognized the source grammar and selected normalized actions; this function consumes those actions rather than CanonicalProgram.R. The action payload is deliberately kept local to the frontend and never becomes a transport representation of Program.

This is a migration boundary, not a claim that every language already has a complete native parser. Source-specific lowerers can replace this function one language at a time without changing SemanticProgram or emitters.

func LowerMatrixEvents

func LowerMatrixEvents(source string, events []matrixir.CanonicalEvent) (*SemanticProgram, error)

LowerMatrixEvents consumes the ordered structural stream emitted by the source matrix adapter. It replaces the old CanonicalProgram.R handoff.

func LowerMatrixEventsWithFactSink added in v1.0.5

func LowerMatrixEventsWithFactSink(language string, events []matrixir.CanonicalEvent, sink *FrontendFactsBuilder) (*SemanticProgram, error)

LowerMatrixEventsWithFactSink is the productive MatrixIR parser boundary. Canonical event text is parsed once into short-lived ParsedNode handles and facts; no SemanticDocument or legacy AST is built on this route.

func LowerMatrixLanguage added in v1.0.5

func LowerMatrixLanguage(language, source string) (*SemanticProgram, error)

LowerMatrixLanguage is the shared frontend path for every currently matrix-recognised source language. Parser-specific facts remain transient; the returned SemanticProgram owns only the canonical UAST.

func LowerNativeGo added in v1.0.5

func LowerNativeGo(filename, source string) (*SemanticProgram, error)

LowerNativeGo lowers the structurally supported Go subset directly from Go's AST. Scalar, aggregate and function values share the same semantic expression contract; unsupported shapes are rejected by the type contract. No normalized source text is created or fed to the legacy parser. Unsupported syntax is an error, including dead unsupported code.

func LowerPython added in v1.0.5

func LowerPython(source string) (*SemanticProgram, error)

LowerPython keeps the concrete frontend entry point while delegating to the language-neutral matrix extractor.

func NewSemanticProgram

func NewSemanticProgram(body *BlockStmt, evaluation string) *SemanticProgram

func ParseSemantic

func ParseSemantic(source, code string) (*SemanticProgram, error)

func ParseSemanticDocument

func ParseSemanticDocument(doc SemanticDocument) (*SemanticProgram, error)

func ParseSemanticJSON

func ParseSemanticJSON(data []byte) (*SemanticProgram, error)

func ParseUniversalASTJSON added in v1.0.5

func ParseUniversalASTJSON(data []byte) (*SemanticProgram, error)

ParseUniversalASTJSON imports a canonical UAST without fabricating a second legacy tree. Compatibility views are materialized only when the projection proves that they are lossless.

func (*SemanticProgram) AttachSemanticFeatureProfile added in v1.0.5

func (p *SemanticProgram) AttachSemanticFeatureProfile(source string) error

AttachSemanticFeatureProfile selects one language row and calculates every program vector. It never fills individual feature cells.

func (*SemanticProgram) Document

func (p *SemanticProgram) Document() (SemanticDocument, error)

func (*SemanticProgram) MarshalSemanticJSON

func (p *SemanticProgram) MarshalSemanticJSON() ([]byte, error)

func (*SemanticProgram) MarshalUniversalASTJSON added in v1.0.5

func (p *SemanticProgram) MarshalUniversalASTJSON() ([]byte, error)

MarshalUniversalASTJSON serializes the canonical representation directly. It also supports richer, currently non-executable UAST documents without inventing a misleading SemanticDocument tree beside them.

func (*SemanticProgram) RSource

func (p *SemanticProgram) RSource(enforce bool) (string, error)

RSource writes executable R syntax from the typed tree. In eager mode calls with user functions are handled by the explicit call-boundary lowering below.

type SemanticScope

type SemanticScope struct {
	ID     int    `json:"id"`
	Kind   string `json:"kind"`
	Parent int    `json:"parent"`
}

type SemanticSemantics

type SemanticSemantics struct {
	Operation       string `json:"operation,omitempty"`
	Dispatch        string `json:"dispatch,omitempty"`
	Overflow        string `json:"overflow,omitempty"`
	EvaluationOrder string `json:"evaluation_order,omitempty"`
	ShortCircuit    bool   `json:"short_circuit,omitempty"`
	IndexBase       int    `json:"index_base,omitempty"`
	NegativeIndex   string `json:"negative_index,omitempty"`
	OutOfBounds     string `json:"out_of_bounds,omitempty"`
	Slicing         string `json:"slicing,omitempty"`
	ErrorModel      string `json:"error_model,omitempty"`
	Confidence      string `json:"confidence,omitempty"`
}

type SemanticSourceSpan

type SemanticSourceSpan struct {
	File        string `json:"file,omitempty"`
	StartOffset int    `json:"start_offset,omitempty"`
	EndOffset   int    `json:"end_offset,omitempty"`
	StartLine   int    `json:"start_line,omitempty"`
	StartColumn int    `json:"start_column,omitempty"`
	EndLine     int    `json:"end_line,omitempty"`
	EndColumn   int    `json:"end_column,omitempty"`
}

type SemanticStatement

type SemanticStatement struct {
	ID         int                 `json:"id"`
	Kind       string              `json:"kind"`
	Scope      int                 `json:"scope"`
	Type       SemanticType        `json:"type,omitempty"`
	TypeOrigin string              `json:"type_origin,omitempty"`
	Semantics  SemanticSemantics   `json:"semantics,omitempty"`
	Effects    []string            `json:"effects,omitempty"`
	Source     *SemanticSourceSpan `json:"source,omitempty"`
	Attributes map[string]any      `json:"attributes,omitempty"`
	Extensions map[string]any      `json:"extensions,omitempty"`
	Name       string              `json:"name,omitempty"`
	AssignOp   string              `json:"assign_op,omitempty"`
	Expression *SemanticExpression `json:"expression,omitempty"`
	Condition  *SemanticExpression `json:"condition,omitempty"`
	Sequence   *SemanticExpression `json:"sequence,omitempty"`
	Then       *SemanticStatement  `json:"then,omitempty"`
	Else       *SemanticStatement  `json:"else,omitempty"`
	Body       *SemanticStatement  `json:"body,omitempty"`
	Statements []SemanticStatement `json:"statements,omitempty"`
}

type SemanticType

type SemanticType struct {
	Identity       string             `json:"identity,omitempty"`
	Reference      bool               `json:"reference,omitempty"`
	Kind           string             `json:"kind,omitempty"`
	Name           string             `json:"name,omitempty"`
	Bits           int                `json:"bits,omitempty"`
	Signed         *bool              `json:"signed,omitempty"`
	IEEE754        bool               `json:"ieee754,omitempty"`
	Element        *SemanticType      `json:"element,omitempty"`
	Key            *SemanticType      `json:"key,omitempty"`
	Value          *SemanticType      `json:"value,omitempty"`
	Parameters     []SemanticType     `json:"parameters,omitempty"`
	Result         *SemanticType      `json:"result,omitempty"`
	Fields         []SemanticField    `json:"fields,omitempty"`
	Length         int                `json:"length,omitempty"`
	Rows           int                `json:"rows,omitempty"`
	Columns        int                `json:"columns,omitempty"`
	Constraints    []string           `json:"constraints,omitempty"`
	Nullable       string             `json:"nullable,omitempty"`
	Ownership      string             `json:"ownership,omitempty"`
	Lifetime       string             `json:"lifetime,omitempty"`
	TypeOrigin     string             `json:"type_origin,omitempty"`
	TypeParameters []SemanticType     `json:"type_parameters,omitempty"`
	TypeArguments  []SemanticType     `json:"type_arguments,omitempty"`
	Constraint     *SemanticType      `json:"constraint,omitempty"`
	Embedded       []SemanticType     `json:"embedded,omitempty"`
	Methods        []SemanticField    `json:"methods,omitempty"`
	Terms          []SemanticTypeTerm `json:"terms,omitempty"`
}

SemanticType is recursive so no JSON number has to carry type information. The textual literal value remains exact even for values JSON cannot represent.

type SemanticTypeContract

type SemanticTypeContract struct {
	SchemaVersion int    `json:"schema_version"`
	Numeric       string `json:"numeric"`
	IntegerWidth  string `json:"integer_width"`
	Text          string `json:"text"`
	Truth         string `json:"truth"`
	Null          string `json:"null"`
	Collection    string `json:"collection"`
	Pointer       string `json:"pointer"`
	Ownership     string `json:"ownership"`
	ABI           string `json:"abi"`
}

SemanticTypeContract is deliberately explicit about what is not yet known. It is part of the language-neutral program contract, not a target profile.

type SemanticTypeDefinition added in v1.0.5

type SemanticTypeDefinition struct {
	ID   int          `json:"id"`
	Type SemanticType `json:"type"`
}

SemanticTypeDefinition gives structural types a stable document-local ID. IDs are assigned from canonical JSON order, never from source traversal.

type SemanticTypeEdge added in v1.0.5

type SemanticTypeEdge struct {
	Role       string `json:"role"`
	Index      int    `json:"index"`
	Name       string `json:"name,omitempty"`
	Underlying bool   `json:"underlying,omitempty"`
}

type SemanticTypeEquivalence added in v1.0.5

type SemanticTypeEquivalence struct {
	Equivalent matrixir.SparseMatrix `json:"equivalent"`
	Unknown    []int                 `json:"unknown"`
	Rounds     int                   `json:"refinement_rounds"`
}

SemanticTypeEquivalence proves exact type-domain equality only. It is not implicit conversion, language-specific assignability, subtyping or ABI equality. Unknown marks types whose identity/shape is insufficient; zero matrix cells involving such types must not be interpreted as a proof of incompatibility.

type SemanticTypeRelations added in v1.0.5

type SemanticTypeRelations struct {
	Occurrences []string                  `json:"occurrences"`
	Uses        matrixir.SparseMatrix     `json:"uses"`
	Edges       []SemanticTypeEdge        `json:"edges"`
	Parents     matrixir.SparseMatrix     `json:"parents"`
	Children    matrixir.SparseMatrix     `json:"children"`
	UsageCounts []int                     `json:"usage_counts"`
	Nominal     *SemanticNominalRelations `json:"nominal,omitempty"`
	Equivalence *SemanticTypeEquivalence  `json:"equivalence,omitempty"`
}

SemanticTypeRelations is a lossless incidence projection of type uses and direct structural edges. Edge rows preserve order and repeated children. The matrices do not assert assignability or executable backend support.

type SemanticTypeTerm added in v1.0.5

type SemanticTypeTerm struct {
	Type       SemanticType `json:"type"`
	Underlying bool         `json:"underlying,omitempty"`
}

SemanticTypeTerm distinguishes an exact type from its underlying-type set.

type SemanticVisitor

type SemanticVisitor interface {
	EnterStatement(*SemanticStatement) error
	LeaveStatement(*SemanticStatement) error
	EnterExpression(*SemanticExpression) error
	LeaveExpression(*SemanticExpression) error
}

SemanticVisitor provides deterministic pre-order traversal of a complete SemanticDocument. Visitors can analyze, validate, optimize or annotate a document without embedding target-specific logic in AST node types.

type SignatureArgument added in v1.0.5

type SignatureArgument struct {
	Name   string `json:"name,omitempty"`
	Spread bool   `json:"spread,omitempty"`
}

SignatureArgument columns preserve original evaluation order. Spread inputs must be expanded by a semantic runtime before binding, never guessed here.

type SignatureBinding added in v1.0.5

type SignatureBinding struct {
	ParameterArguments matrixir.SparseMatrix `json:"parameter_arguments"`
	UseDefaults        []int                 `json:"use_defaults"`
	ArgumentCounts     []int                 `json:"argument_counts"`
}

func BindSignature added in v1.0.5

func BindSignature(parameters []SignatureParameter, arguments []SignatureArgument) (*SignatureBinding, error)

BindSignature derives a parameter x argument incidence matrix. Matrix row sums then check required/default/variadic cardinalities for the whole call. It does not execute defaults, annotation expressions or function bodies.

type SignatureParameter added in v1.0.5

type SignatureParameter struct {
	Name       string `json:"name"`
	Passing    string `json:"passing"`
	HasDefault bool   `json:"has_default"`
}

SignatureParameter describes call binding, independently of evaluation and value/reference passing. Defaults must be evaluated by the source contract.

type Stmt

type Stmt interface {
	// contains filtered or unexported methods
}

type StructureProjectionContract added in v1.0.5

type StructureProjectionContract struct {
	StructureKind       string   `json:"structure_kind"`
	ProjectionClass     string   `json:"projection_class"`
	ProjectionForm      string   `json:"projection_form"`
	SyntacticCategory   string   `json:"syntactic_category"`
	ChildRelations      []string `json:"child_relations"`
	RequiredFields      []string `json:"required_fields"`
	ExecutionPrimitives []string `json:"execution_primitives"`
	PrecedenceRole      string   `json:"precedence_role"`
	BlockPolicy         string   `json:"block_policy"`
	TerminatorPolicy    string   `json:"terminator_policy"`
	EmissionPolicy      string   `json:"emission_policy"`
	Implemented         bool     `json:"implemented"`
}

StructureProjectionContract is a declarative, schema-derived syntax contract. It is not an IR and never stores program data: the projector reads program semantics only from UniversalASTDocument.

type StructuredConstructInput added in v1.0.6

type StructuredConstructInput struct {
	Family       string
	NodeKind     string
	Roles        []matrixir.CanonicalRoleFact
	Operands     []matrixir.CanonicalOperandFact
	Bindings     []matrixir.CanonicalBindingFact
	Types        []matrixir.CanonicalSymbolFact
	Fields       map[string]string
	SourceOffset int
}

StructuredConstructInput is a short-lived parser DTO. It deliberately has no target, runtime, UAST facet, or execution information.

func MatrixStructuredAdapter added in v1.0.6

func MatrixStructuredAdapter(event matrixir.CanonicalSemanticEvent) (StructuredConstructInput, bool)

MatrixStructuredAdapter transfers only already-proven MatrixIR structure. Event.Text is intentionally not read on this path.

type TargetCapabilityDecision added in v1.0.5

type TargetCapabilityDecision struct {
	Direct, Rewrite, Helper, Emulate, Runtime, Unsupported []string
}

type TargetImportSpec added in v1.0.5

type TargetImportSpec struct {
	RuntimeRequirement string `json:"runtime_requirement"`
	Ordering           string `json:"ordering"`
	Prelude            string `json:"-"`
}

type TargetLiteralSpec added in v1.0.5

type TargetLiteralSpec struct {
	True        string `json:"true"`
	False       string `json:"false"`
	Null        string `json:"null"`
	StringQuote string `json:"string_quote"`
	StringWrap  string `json:"string_wrap"`
	NumberWrap  string `json:"number_wrap"`
	NumberRule  string `json:"number_rule"`
}

type TargetNamingSpec added in v1.0.5

type TargetNamingSpec struct {
	CaseSensitive    bool   `json:"case_sensitive"`
	StyleInsensitive bool   `json:"style_insensitive"`
	GeneratedPrefix  string `json:"generated_prefix"`
}

type TargetOperatorSpec added in v1.0.5

type TargetOperatorSpec struct {
	Spelling      string `json:"spelling"`
	Precedence    int    `json:"precedence"`
	Associativity string `json:"associativity"`
	Fixity        string `json:"fixity"`
}

type TargetProjectionSpec added in v1.0.5

type TargetProjectionSpec struct {
	Mode         PreservationMode `json:"mode"`
	Requirements []string         `json:"requirements,omitempty"`
}

TargetProjectionSpec is a syntax/runtime declaration for a whole family of schema-derived projection contracts. It contains no source-program data.

type TargetSpec added in v1.0.5

type TargetSpec struct {
	ID                  string                          `json:"id"`
	Aliases             []string                        `json:"aliases"`
	Capabilities        []string                        `json:"capabilities"`
	StatementTerminator string                          `json:"statement_terminator"`
	ChildSeparator      string                          `json:"child_separator"`
	Indent              string                          `json:"indent"`
	BlockOpen           string                          `json:"block_open"`
	BlockClose          string                          `json:"block_close"`
	Hooks               []string                        `json:"hooks"`
	Operators           map[string]TargetOperatorSpec   `json:"operators"`
	Types               map[string]string               `json:"types"`
	Literals            TargetLiteralSpec               `json:"literals"`
	Naming              TargetNamingSpec                `json:"naming"`
	Imports             TargetImportSpec                `json:"imports"`
	TypedOperations     TargetTypedOperationSpec        `json:"typed_operations"`
	ProjectionForms     map[string]TargetProjectionSpec `json:"projection_forms"`
	SyntaxTokens        map[string]string               `json:"syntax_tokens"`
}

TargetSpec is declarative target syntax and capability metadata. It never carries source-program semantics: those remain exclusively in UAST.

func RegisteredTargetSpecs added in v1.0.5

func RegisteredTargetSpecs() []TargetSpec

RegisteredTargetSpecs is derived from the target registry, keeping the set of targets single-sourced. The hook names document existing syntax helpers that are deliberately reused during this migration.

type TargetStructureSyntaxCell added in v1.0.5

type TargetStructureSyntaxCell struct {
	Target          string
	StructureKind   string
	ProjectionClass string
	TemplateID      string
	ProjectionForm  string
	Complete        bool
	MissingReason   string
}

TargetStructureSyntaxCell is the exact structure-granular expansion of a TargetSyntaxTemplateCell. The 13×73 class matrix is retained for quotient analysis; this table is used when a class contains multiple syntax forms. It is a checked contract row, never a program representation.

type TargetSyntaxCheck added in v1.0.6

type TargetSyntaxCheck struct {
	Checked bool   `json:"checked"`
	Valid   bool   `json:"valid"`
	Tool    string `json:"tool,omitempty"`
	Failure string `json:"failure,omitempty"`
}

TargetSyntaxCheck is an observation of a parser/compiler in syntax-only mode. Checked=false means the local toolchain is unavailable; it is not a positive syntax proof and is kept separate in reports.

func CheckTargetSyntax added in v1.0.6

func CheckTargetSyntax(target, source string) TargetSyntaxCheck

CheckTargetSyntax parses generated source without executing it. Native output that fails an available target parser is ineligible for DIRECT and will reach the central compatibility fallback.

type TargetSyntaxTemplate added in v1.0.5

type TargetSyntaxTemplate struct {
	ID              string
	Signature       string
	ProjectionForms []string
	RecipeIDs       []string
	Available       bool
}

TargetSyntaxTemplate is a declarative, syntax-only quotient class. It has neither UAST node data nor source-language meaning; the canonical UAST remains the only semantic input to the projector.

type TargetSyntaxTemplateAnalysis added in v1.0.5

type TargetSyntaxTemplateAnalysis struct {
	Templates        []TargetSyntaxTemplate
	Cells            []TargetSyntaxTemplateCell
	StructureCells   []TargetStructureSyntaxCell
	ExistingMatches  int
	MissingTemplate  int
	MissingParameter int
}

TargetSyntaxTemplateAnalysis is the checked 13×73 syntax contract plane. It is a registry/report, not a target or semantic intermediate representation.

func UniversalTargetSyntaxTemplateAnalysis added in v1.0.5

func UniversalTargetSyntaxTemplateAnalysis() (TargetSyntaxTemplateAnalysis, error)

func WriteTargetSyntaxTemplateAnalysis added in v1.0.5

func WriteTargetSyntaxTemplateAnalysis(dir string) (TargetSyntaxTemplateAnalysis, error)

func (TargetSyntaxTemplateAnalysis) Cell added in v1.0.5

func (a TargetSyntaxTemplateAnalysis) Cell(target, projectionClass string) (TargetSyntaxTemplateCell, bool)

func (TargetSyntaxTemplateAnalysis) StructureCell added in v1.0.5

func (a TargetSyntaxTemplateAnalysis) StructureCell(target, structure string) (TargetStructureSyntaxCell, bool)

func (TargetSyntaxTemplateAnalysis) SupportsContract added in v1.0.5

func (a TargetSyntaxTemplateAnalysis) SupportsContract(target string, contract StructureProjectionContract, spec TargetSpec) bool

SupportsContract resolves a single structural member of a projection class. Projection classes are an execution quotient and can contain more than one syntax form. A class-level Complete=false must therefore never suppress a separately proved direct renderer for another member of that class.

type TargetSyntaxTemplateCell added in v1.0.5

type TargetSyntaxTemplateCell struct {
	Target          string
	ProjectionClass string
	TemplateID      string
	SyntaxSignature string
	ProjectionForm  string
	RecipeIDs       []string
	Complete        bool
	MissingReason   string
	Parameters      map[string]string
}

TargetSyntaxTemplateCell is one Target × ProjectionClass decision. Target parameters are deliberately stored separately from the target-independent template signature.

type TargetSyntaxTemplateForm added in v1.0.5

type TargetSyntaxTemplateForm struct {
	ProjectionForm string
	RendererID     string
}

TargetSyntaxTemplateForm identifies a syntax form already emitted directly from uastExecutionGraph. The table contains no program semantics and is deliberately smaller than the target×projection matrix.

type TargetTypedOperationSpec added in v1.0.5

type TargetTypedOperationSpec struct{ Form, Runtime, ArgumentsOpen, ArgumentsClose, SignedTrue, SignedFalse string }

type UASTBackendAuditReport added in v1.0.5

type UASTBackendAuditReport struct {
	CanonicalInput                 string                        `json:"canonical_input"`
	UniversalCoreUASTOnly          bool                          `json:"universal_core_uast_only"`
	ProductiveLegacyASTDependency  bool                          `json:"productive_legacy_ast_dependency"`
	SourceLanguageSemanticBranches int                           `json:"source_language_semantic_branches"`
	FrontendSemanticBoundaries     int                           `json:"frontend_semantic_conversion_boundaries"`
	BackendSemanticBoundaries      int                           `json:"backend_semantic_conversion_boundaries"`
	Targets                        []UASTTargetBackendAudit      `json:"targets"`
	Compatibility                  UASTSourceTargetCompatibility `json:"source_target_compatibility"`
}

func UniversalBackendAuditReport added in v1.0.5

func UniversalBackendAuditReport() (UASTBackendAuditReport, error)

UniversalBackendAuditReport is generated from the registered backends and the same capability planes used before target emission. The compatibility matrix covers the currently tested common UAST baseline, not unimplemented schema rows.

type UASTBackendPath added in v1.0.5

type UASTBackendPath struct {
	Name     string `json:"name"`
	Mode     string `json:"mode"`
	Function string `json:"function"`
}

type UASTCapabilityPlane added in v1.0.5

type UASTCapabilityPlane struct {
	Rows             []string              `json:"rows"`
	Targets          []string              `json:"targets"`
	Direct           matrixir.SparseMatrix `json:"direct"`
	LoweringRequired matrixir.SparseMatrix `json:"lowering_required"`
	RuntimeRequired  matrixir.SparseMatrix `json:"runtime_required"`
	Unsupported      matrixir.SparseMatrix `json:"unsupported"`
	Unknown          matrixir.SparseMatrix `json:"unknown"`
}

UASTCapabilityPlane is a one-hot status tensor flattened into five sparse matrices. Rows are universal items and columns are registered targets.

func (UASTCapabilityPlane) Status added in v1.0.5

func (p UASTCapabilityPlane) Status(row, col int) UASTExecutionStatus

type UASTConsumerKind added in v1.0.5

type UASTConsumerKind string

UASTConsumerKind identifies the productive direct-UAST consumer that owns a contract. It classifies consumption without creating a second IR.

const (
	UASTRuntimeConsumed          UASTConsumerKind = "RUNTIME_CONSUMED"
	UASTValidationConsumed       UASTConsumerKind = "VALIDATION_CONSUMED"
	UASTTypeSystemConsumed       UASTConsumerKind = "TYPE_SYSTEM_CONSUMED"
	UASTControlFlowConsumed      UASTConsumerKind = "CONTROL_FLOW_CONSUMED"
	UASTRequirementConsumed      UASTConsumerKind = "REQUIREMENT_CONSUMED"
	UASTTargetProjectionConsumed UASTConsumerKind = "TARGET_PROJECTION_CONSUMED"
	UASTCompileTimeConsumed      UASTConsumerKind = "COMPILETIME_CONSUMED"
)

type UASTDirectExecutionItem added in v1.0.5

type UASTDirectExecutionItem struct {
	Category                   string   `json:"category"`
	Name                       string   `json:"name"`
	Projected                  bool     `json:"projected"`
	CurrentlyDirect            bool     `json:"currently_direct"`
	CurrentlyViaLegacyAdapter  bool     `json:"currently_via_legacy_adapter"`
	RepresentableNotExecutable bool     `json:"representable_not_executable"`
	StoredOnly                 bool     `json:"stored_only,omitempty"`
	DirectTargets              []string `json:"direct_targets,omitempty"`
	LowerableTargets           []string `json:"lowerable_targets,omitempty"`
	RuntimeRequiredTargets     []string `json:"runtime_required_targets,omitempty"`
	UnsupportedTargets         []string `json:"unsupported_targets,omitempty"`
	UnknownTargets             []string `json:"unknown_targets,omitempty"`
}

type UASTDirectExecutionReport added in v1.0.5

type UASTDirectExecutionReport struct {
	Schema             string                       `json:"schema"`
	BasisSHA256        string                       `json:"basis_sha256"`
	Summary            map[string]map[string]int    `json:"summary"`
	Items              []UASTDirectExecutionItem    `json:"items"`
	BackendPaths       []UASTBackendPath            `json:"backend_paths"`
	TargetCapabilities UASTTargetCapabilityMatrix   `json:"target_capabilities"`
	TargetPreservation UASTTargetPreservationMatrix `json:"target_preservation"`
	Execution          UASTExecutionAnalysis        `json:"execution"`
	EndToEnd           UASTEndToEndCapabilityReport `json:"end_to_end"`
	BackendAudit       UASTBackendAuditReport       `json:"backend_audit"`
}

func UniversalDirectExecutionReport added in v1.0.5

func UniversalDirectExecutionReport() (UASTDirectExecutionReport, error)

type UASTEndToEndCapabilityPlane added in v1.0.5

type UASTEndToEndCapabilityPlane struct {
	Rows               []string              `json:"rows"`
	Representable      matrixir.SparseMatrix `json:"representable"`
	Frontend           matrixir.SparseMatrix `json:"frontend"`
	Enrichment         matrixir.SparseMatrix `json:"enrichment"`
	Evidence           matrixir.SparseMatrix `json:"evidence"`
	Normalize          matrixir.SparseMatrix `json:"normalize"`
	Backend            matrixir.SparseMatrix `json:"backend"`
	Target             matrixir.SparseMatrix `json:"target"`
	Test               matrixir.SparseMatrix `json:"test"`
	Full               matrixir.SparseMatrix `json:"full"`
	RepresentationOnly matrixir.SparseMatrix `json:"representation_only"`
	FrontendGap        matrixir.SparseMatrix `json:"frontend_gap"`
	EnrichmentGap      matrixir.SparseMatrix `json:"enrichment_gap"`
	EvidenceGap        matrixir.SparseMatrix `json:"evidence_gap"`
	BackendGap         matrixir.SparseMatrix `json:"backend_gap"`
	TargetGap          matrixir.SparseMatrix `json:"target_gap"`
	TestGap            matrixir.SparseMatrix `json:"test_gap"`
}

UASTEndToEndCapabilityPlane records one boolean column per pipeline stage. It is deliberately a report of proved paths, not a priority or ranking.

type UASTEndToEndCapabilityReport added in v1.0.5

type UASTEndToEndCapabilityReport struct {
	Structures UASTEndToEndCapabilityPlane `json:"structures"`
	Relations  UASTEndToEndCapabilityPlane `json:"relations"`
	Facets     UASTEndToEndCapabilityPlane `json:"facets"`
	Fields     UASTEndToEndCapabilityPlane `json:"fields"`
	Summary    map[string]map[string]int   `json:"summary"`
}

func UniversalEndToEndCapabilityReport added in v1.0.5

func UniversalEndToEndCapabilityReport() (UASTEndToEndCapabilityReport, error)

UniversalEndToEndCapabilityReport combines the existing schema/crosswalk matrices with the proven direct frontend, normalizer, backend and test contracts. A cell becomes FULL only when every boolean pipeline vector is 1.

type UASTExecutionAnalysis added in v1.0.5

type UASTExecutionAnalysis struct {
	Schema                    string                        `json:"schema"`
	BasisSHA256               string                        `json:"basis_sha256"`
	Primitives                []UASTExecutionPrimitiveSpec  `json:"primitives"`
	Capabilities              []string                      `json:"capabilities"`
	Structures                []string                      `json:"structures"`
	Relations                 []string                      `json:"relations"`
	Fields                    []string                      `json:"fields"`
	MCE                       matrixir.SparseMatrix         `json:"m_ce"`
	MSE                       matrixir.SparseMatrix         `json:"m_se"`
	MRE                       matrixir.SparseMatrix         `json:"m_re"`
	MDE                       matrixir.SparseMatrix         `json:"m_de"`
	Implemented               matrixir.Vector               `json:"exec_primitive_implemented"`
	Executable                matrixir.Vector               `json:"executable_uasf"`
	ExecutableStructures      matrixir.Vector               `json:"executable_structures"`
	ExecutableRelations       matrixir.Vector               `json:"executable_relations"`
	ExecutableFields          matrixir.Vector               `json:"executable_fields"`
	ProductivelyConsumed      matrixir.Vector               `json:"productively_consumed_uasf"`
	ConsumerCoverage          map[string][]UASTConsumerKind `json:"consumer_coverage"`
	Missing                   matrixir.SparseMatrix         `json:"missing_primitives"`
	GlobalMissing             map[string]int                `json:"global_missing_primitives"`
	EquivalenceClasses        []UASTExecutionClass          `json:"execution_equivalence_classes"`
	ProductiveLegacyRelations int                           `json:"productive_legacy_semantic_dependencies"`
}

UASTExecutionAnalysis contains the four required boolean matrices and the exact UASF quotient. Executable is one only when each primitive in the UASF row has a real product handler.

func UniversalExecutionAnalysis added in v1.0.5

func UniversalExecutionAnalysis() (UASTExecutionAnalysis, error)

UniversalExecutionAnalysis derives M_CE, M_SE, M_RE and M_DE directly from the canonical UAST basis. It uses exact row equality for the quotient.

func WriteUniversalExecutionAnalysis added in v1.0.5

func WriteUniversalExecutionAnalysis(dir string) (UASTExecutionAnalysis, error)

WriteUniversalExecutionAnalysis writes the quotient and missing primitive matrices. The files are reproducible reports of the canonical UAST basis.

type UASTExecutionClass added in v1.0.5

type UASTExecutionClass struct {
	ID                 string   `json:"id"`
	UASFMembers        []string `json:"uasf_members"`
	ExecutionSignature string   `json:"execution_signature"`
	RequiredPrimitives []string `json:"required_primitives"`
}

type UASTExecutionPrimitive added in v1.0.5

type UASTExecutionPrimitive string

UASTExecutionPrimitive is a behavior already consumed by the direct UAST runtime, validator, or target projector. It is not another semantic IR: the UAST graph remains the sole input and the registry only describes which existing execution paths a graph requires.

type UASTExecutionPrimitiveSpec added in v1.0.5

type UASTExecutionPrimitiveSpec struct {
	ID          UASTExecutionPrimitive `json:"id"`
	Implemented bool                   `json:"implemented"`
	Handler     string                 `json:"handler,omitempty"`
	Consumers   []UASTConsumerKind     `json:"consumers,omitempty"`
}

type UASTExecutionRegistry added in v1.0.5

type UASTExecutionRegistry struct {
	Primitives      []UASTExecutionPrimitiveSpec
	SemanticAxis    map[string][]UASTExecutionPrimitive
	RelationAxis    map[string][]UASTExecutionPrimitive
	StructuralLayer map[string][]UASTExecutionPrimitive
	Relation        map[string][]UASTExecutionPrimitive
	Field           map[string][]UASTExecutionPrimitive
}

UASTExecutionRegistry maps canonical schema axes to execution primitives. All rows are boolean and are derived from the checked-in axis labels and the actual direct UAST entry points named in Handler.

func DefaultUASTExecutionRegistry added in v1.0.5

func DefaultUASTExecutionRegistry() UASTExecutionRegistry

type UASTExecutionStatus added in v1.0.5

type UASTExecutionStatus string
const (
	UASTDirect          UASTExecutionStatus = "direct"
	UASTLowering        UASTExecutionStatus = "lowerable"
	UASTRuntimeRequired UASTExecutionStatus = "runtime-required"
	UASTUnsupported     UASTExecutionStatus = "unsupported"
	UASTUnknown         UASTExecutionStatus = "unknown"
)

type UASTPreservationAnalysis added in v1.0.5

type UASTPreservationAnalysis struct {
	Schema               string                             `json:"schema"`
	BasisSHA256          string                             `json:"basis_sha256"`
	Capabilities         []string                           `json:"capabilities"`
	Targets              []string                           `json:"targets"`
	Primitives           []UASTPreservationPrimitive        `json:"primitives"`
	MCP                  matrixir.SparseMatrix              `json:"m_cp"`
	MTP                  matrixir.SparseMatrix              `json:"m_tp"`
	Contracts            []UASTPreservationContract         `json:"m_ctp"`
	EquivalenceClasses   []UASTPreservationEquivalenceClass `json:"preservation_equivalence_classes"`
	GlobalMissing        map[string]int                     `json:"global_missing_preservation_primitives"`
	ErrorReasons         map[string]int                     `json:"error_reasons"`
	Unclassified         int                                `json:"unclassified"`
	ProductiveLegacyDeps int                                `json:"productive_legacy_semantic_dependencies"`
}

UASTPreservationAnalysis is the complete matrix-derived target preservation contract. MCP is UASF × PreservationPrimitive, MTP is Target × PreservationPrimitive, and MCTP is the explicit flattened product in Contracts. No source-language data occurs in this analysis.

func UniversalTargetPreservationAnalysis added in v1.0.5

func UniversalTargetPreservationAnalysis() (UASTPreservationAnalysis, error)

UniversalTargetPreservationAnalysis computes the target contract quotient from the canonical execution matrix and the existing proven target paths. Target primitive availability is proved by a currently executable UAST facet that requires the primitive; an unused primitive is not promoted by declaration alone. The target.syntax requirement is then added per cell from the real direct-UAST emitter boundary, so broader UASF rows cannot borrow syntax support from the small tested core.

func WriteUASTPreservationAnalysis added in v1.0.5

func WriteUASTPreservationAnalysis(dir string) (UASTPreservationAnalysis, error)

type UASTPreservationContract added in v1.0.5

type UASTPreservationContract struct {
	Target              string           `json:"target"`
	UASF                string           `json:"uasf"`
	CurrentMode         PreservationMode `json:"current_mode"`
	RequiredPrimitives  []string         `json:"required_primitives"`
	AvailablePrimitives []string         `json:"available_primitives"`
	MissingPrimitives   []string         `json:"missing_primitives"`
	ErrorReason         string           `json:"error_reason,omitempty"`
	FallbacksChecked    []string         `json:"fallbacks_checked"`
}

UASTPreservationContract is one flattened Target × UASF × Primitive cell. Required, Available and Missing make M_CTP inspectable without inventing a tensor type or a second semantic representation.

type UASTPreservationEquivalenceClass added in v1.0.5

type UASTPreservationEquivalenceClass struct {
	ID                 string           `json:"class_id"`
	Targets            []string         `json:"targets"`
	UASFMembers        []string         `json:"uasf_members"`
	RequiredPrimitives []string         `json:"required_primitives"`
	CurrentMode        PreservationMode `json:"current_mode"`
	MissingPrimitives  []string         `json:"missing_primitives"`
	ErrorReason        string           `json:"error_reason,omitempty"`
}

type UASTPreservationPrimitive added in v1.0.5

type UASTPreservationPrimitive struct {
	ID        string                 `json:"id"`
	Execution UASTExecutionPrimitive `json:"execution_primitive"`
}

UASTPreservationPrimitive is a target-side realization of one already canonical execution contract. It is a registry row, not an IR node.

type UASTSourceTargetCompatibility added in v1.0.5

type UASTSourceTargetCompatibility struct {
	Sources     []string              `json:"sources"`
	Targets     []string              `json:"targets"`
	Full        matrixir.SparseMatrix `json:"full"`
	Partial     matrixir.SparseMatrix `json:"partial"`
	Unsupported matrixir.SparseMatrix `json:"unsupported"`
}

type UASTStructureProjectionRegistry added in v1.0.5

type UASTStructureProjectionRegistry struct {
	Schema           string                        `json:"schema"`
	BasisSHA256      string                        `json:"basis_sha256"`
	Contracts        []StructureProjectionContract `json:"contracts"`
	Classes          map[string][]string           `json:"classes"`
	ClassProjectable map[string]bool               `json:"class_projectable"`
	FieldUse         map[string]string             `json:"field_use"`
	RelationUse      map[string]string             `json:"relation_use"`
}

UASTStructureProjectionRegistry is the exact quotient of the canonical structural matrix by syntax requirements. Contracts sharing a class have the same layers, child relations, fields and execution requirements.

func UniversalStructureProjectionRegistry added in v1.0.5

func UniversalStructureProjectionRegistry() (UASTStructureProjectionRegistry, error)

UniversalStructureProjectionRegistry returns the immutable schema quotient cached for this process. The registry is recomputed only across processes from the embedded matrices; callers must treat the returned data as read-only.

func WriteUASTStructureProjectionRegistry added in v1.0.5

func WriteUASTStructureProjectionRegistry(dir string) (UASTStructureProjectionRegistry, error)

WriteUASTStructureProjectionRegistry produces the machine-readable projection quotient used to identify a shared projector gap before any target-specific code is written.

type UASTTargetBackendAudit added in v1.0.5

type UASTTargetBackendAudit struct {
	Language                 string         `json:"language"`
	UASTDirect               bool           `json:"uast_direct"`
	LegacyDependency         bool           `json:"legacy_dependency"`
	SourceLanguageDependency bool           `json:"source_language_dependency"`
	StructureCapabilities    map[string]int `json:"structure_capabilities"`
	RelationCapabilities     map[string]int `json:"relation_capabilities"`
	FacetCapabilities        map[string]int `json:"facet_capabilities"`
	FieldCapabilities        map[string]int `json:"field_capabilities"`
}

UASTTargetBackendAudit describes the registered target contract. Semantic lowering always enters through UAST; target-specific code only renders the already-proved canonical facts in its own syntax.

type UASTTargetCapabilityMatrix added in v1.0.5

type UASTTargetCapabilityMatrix struct {
	Structures   UASTCapabilityPlane                  `json:"structures"`
	Facets       UASTCapabilityPlane                  `json:"facets"`
	Relations    UASTCapabilityPlane                  `json:"relations"`
	Fields       UASTCapabilityPlane                  `json:"fields"`
	StatusCounts map[string]map[string]map[string]int `json:"status_counts"`
}

func UniversalTargetCapabilityMatrix added in v1.0.5

func UniversalTargetCapabilityMatrix() (UASTTargetCapabilityMatrix, error)

type UASTTargetPreservationMatrix added in v1.0.5

type UASTTargetPreservationMatrix struct {
	Schema       string                    `json:"schema"`
	BasisSHA256  string                    `json:"basis_sha256"`
	Capabilities []string                  `json:"capabilities"`
	Targets      []string                  `json:"targets"`
	Direct       matrixir.SparseMatrix     `json:"direct"`
	Rewrite      matrixir.SparseMatrix     `json:"rewrite"`
	Helper       matrixir.SparseMatrix     `json:"helper"`
	Emulate      matrixir.SparseMatrix     `json:"emulate"`
	Runtime      matrixir.SparseMatrix     `json:"runtime"`
	Error        matrixir.SparseMatrix     `json:"error"`
	StatusCounts map[string]map[string]int `json:"status_counts"`
}

UASTTargetPreservationMatrix is the complete target × UASF decision plane. It is a declaration of actual product paths, not a prediction. Every cell is one-hot: DIRECT, REWRITE, HELPER, EMULATE, RUNTIME, or explicit ERROR. The matrix is a registry-derived table and is not another semantic IR.

func UniversalTargetPreservationMatrix added in v1.0.5

func UniversalTargetPreservationMatrix() (UASTTargetPreservationMatrix, error)

UniversalTargetPreservationMatrix classifies every canonical UASF for every registered target. The generic target emitter and checked-in per-target runtime support the core structural quotient. Remaining canonical UASF rows are deliberately ERROR until a real lowering, helper, emulator, or runtime module is registered; they are never silently treated as unknown.

func WriteUASTTargetPreservationMatrix added in v1.0.5

func WriteUASTTargetPreservationMatrix(dir string) (UASTTargetPreservationMatrix, error)

func (UASTTargetPreservationMatrix) Status added in v1.0.5

type UnaryExpr

type UnaryExpr struct {
	Op string
	X  Expr
}

type UniversalASTBasis added in v1.0.5

type UniversalASTBasis struct {
	Schema                     string                `json:"schema"`
	Features                   []string              `json:"features"`
	Facets                     []string              `json:"facets"`
	SemanticAxes               []string              `json:"semantic_axes"`
	RelationAxes               []string              `json:"relation_axes"`
	Languages                  []string              `json:"languages"`
	StructuralKinds            []string              `json:"structural_kinds"`
	ConcreteRelations          []string              `json:"concrete_relations"`
	Fields                     []string              `json:"fields"`
	Layers                     []string              `json:"layers"`
	GlobalRelations            []string              `json:"global_relations"`
	CrosswalkFields            []string              `json:"crosswalk_fields"`
	FeatureFacet               matrixir.SparseMatrix `json:"feature_facet"`
	FeatureSignature           matrixir.SparseMatrix `json:"feature_signature"`
	FacetAxis                  matrixir.SparseMatrix `json:"facet_axis"`
	FacetRelationAxis          matrixir.SparseMatrix `json:"facet_relation_axis"`
	LanguageFacet              matrixir.SparseMatrix `json:"language_facet"`
	CoverageLower              matrixir.SparseMatrix `json:"coverage_lower"`
	CoverageUpper              matrixir.SparseMatrix `json:"coverage_upper"`
	StructuralFacetSeed        matrixir.SparseMatrix `json:"structural_facet_seed"`
	FacetLayer                 matrixir.SparseMatrix `json:"facet_layer"`
	StructuralLayer            matrixir.SparseMatrix `json:"structural_layer"`
	FacetConcreteRelation      matrixir.SparseMatrix `json:"facet_concrete_relation"`
	StructuralConcreteRelation matrixir.SparseMatrix `json:"structural_concrete_relation"`
	FacetField                 matrixir.SparseMatrix `json:"facet_field"`
	StructuralField            matrixir.SparseMatrix `json:"structural_field"`
}

type UniversalASTCanonicalCoverage added in v1.0.5

type UniversalASTCanonicalCoverage struct {
	Structures int `json:"structures"`
	Relations  int `json:"relations"`
	Facets     int `json:"facets"`
	Fields     int `json:"fields"`
	UASFReady  int `json:"uast_ready"`
}

UniversalASTCanonicalCoverage describes the representability contract of the embedded UAST schema. It is deliberately separate from execution and target-preservation reports: a canonical facet can be represented before a frontend mapping is proven or a target lowering exists.

func CanonicalUniversalASTCoverage added in v1.0.5

func CanonicalUniversalASTCoverage() (UniversalASTCanonicalCoverage, error)

CanonicalUniversalASTCoverage returns the complete structural coverage of the canonical UAST basis. It fails if the embedded schema is malformed.

type UniversalASTDocument added in v1.0.5

type UniversalASTDocument struct {
	SchemaVersion          int                      `json:"schema_version"`
	BasisSHA256            string                   `json:"basis_sha256"`
	LanguageProfile        string                   `json:"language_profile"`
	LanguageFacet          matrixir.Vector          `json:"language_facet"`
	Projection             string                   `json:"projection,omitempty"`
	SemanticDocumentSHA256 string                   `json:"semantic_document_sha256,omitempty"`
	Evaluation             string                   `json:"evaluation,omitempty"`
	ValueModel             string                   `json:"value_model,omitempty"`
	IndexBase              int                      `json:"index_base,omitempty"`
	Types                  SemanticTypeContract     `json:"type_contract,omitempty"`
	Origin                 SemanticOrigin           `json:"origin,omitempty"`
	Metadata               map[string]string        `json:"metadata,omitempty"`
	Extensions             map[string]any           `json:"extensions,omitempty"`
	Contracts              SemanticContracts        `json:"contracts,omitempty"`
	Dialects               []SemanticDialect        `json:"dialects,omitempty"`
	SemanticFeatures       *SemanticFeatureModel    `json:"semantic_features,omitempty"`
	TypeTable              []SemanticTypeDefinition `json:"type_table,omitempty"`
	TypeGraph              matrixir.SparseMatrix    `json:"type_graph,omitempty"`
	TypeRelations          *SemanticTypeRelations   `json:"type_relations,omitempty"`
	Evidence               SemanticEvidence         `json:"evidence,omitempty"`
	Nodes                  []UniversalASTNode       `json:"nodes"`
	Relations              []UniversalASTRelation   `json:"relations"`
}

func BuildCanonicalUniversalASTFromFrontendFacts added in v1.0.5

func BuildCanonicalUniversalASTFromFrontendFacts(f FrontendSemanticFacts) (*UniversalASTDocument, error)

BuildCanonicalUniversalASTFromFrontendFacts is the single generic frontend route. Evidence is always derived by AnalyzeUniversalEvidence; the frontend cannot add guessed evidence through this builder.

func BuildCanonicalUniversalASTFromParseNode added in v1.0.6

func BuildCanonicalUniversalASTFromParseNode(language string, root *matrixir.ParseNode) (*UniversalASTDocument, error)

BuildCanonicalUniversalASTFromParseNode is the common, language-neutral bridge from the table parser's neutral reduction tree to the existing UAST facts pipeline. It deliberately uses only node shape, fields and source spans; language-specific parser branches are not involved.

func BuildRawUniversalASTFromFrontendFacts added in v1.0.5

func BuildRawUniversalASTFromFrontendFacts(f FrontendSemanticFacts) (*UniversalASTDocument, error)

BuildRawUniversalASTFromFrontendFacts materializes exactly the facts that a frontend proved. It does not infer fields, facets, relations or evidence.

func NewUniversalASTDocument added in v1.0.5

func NewUniversalASTDocument(source string) (*UniversalASTDocument, error)

func NormalizeUniversalAST added in v1.0.5

func NormalizeUniversalAST(d *UniversalASTDocument) (*UniversalASTDocument, error)

NormalizeUniversalAST is the shared canonical validation/normalization pass for all ingress paths. It operates only on UAST data and never constructs a legacy statement or expression tree.

func ProjectSemanticDocumentToUniversal added in v1.0.5

func ProjectSemanticDocumentToUniversal(doc SemanticDocument) (*UniversalASTDocument, error)

ProjectSemanticDocumentToUniversal is the compatibility crosswalk. Facets come only from supplied structural seed rows; no unseeded facet is guessed.

func (*UniversalASTDocument) AddNode added in v1.0.5

func (d *UniversalASTDocument) AddNode(kind string, facets []string, fields map[string]json.RawMessage) (int, error)

func (*UniversalASTDocument) AddRelation added in v1.0.5

func (d *UniversalASTDocument) AddRelation(kind string, from int, to UniversalASTReference, attributes map[string]json.RawMessage) error

type UniversalASTNode added in v1.0.5

type UniversalASTNode struct {
	ID             int                        `json:"id"`
	StructuralKind string                     `json:"structural_kind"`
	SemanticFacets []string                   `json:"semantic_facets,omitempty"`
	FieldMask      []string                   `json:"field_mask"`
	Fields         map[string]json.RawMessage `json:"fields,omitempty"`
	Source         *SemanticSourceSpan        `json:"source_span,omitempty"`
	Attributes     map[string]json.RawMessage `json:"attributes,omitempty"`
}

type UniversalASTReference added in v1.0.5

type UniversalASTReference struct {
	Domain string `json:"domain"`
	ID     string `json:"id"`
}

type UniversalASTRelation added in v1.0.5

type UniversalASTRelation struct {
	Kind       string                     `json:"kind"`
	From       int                        `json:"from"`
	To         UniversalASTReference      `json:"to"`
	Attributes map[string]json.RawMessage `json:"attributes,omitempty"`
}

type UniversalFormatter added in v1.0.5

type UniversalFormatter struct {
	Indent  string
	Newline string
}

UniversalFormatter knows only document layout. Semantic analysis is complete before a Doc is constructed.

func (UniversalFormatter) Format added in v1.0.5

func (f UniversalFormatter) Format(doc Doc) string

type UniversalHelperResolver added in v1.0.5

type UniversalHelperResolver struct{}

func (UniversalHelperResolver) Resolve added in v1.0.5

func (UniversalHelperResolver) Resolve(requirements []HelperRequirement, registry map[string]HelperSpec) ([]HelperSpec, error)

type UniversalTargetNameResolver added in v1.0.5

type UniversalTargetNameResolver struct{}

func (UniversalTargetNameResolver) Resolve added in v1.0.5

func (UniversalTargetNameResolver) Resolve(preferred string, spec TargetSpec) string

type UniversalTargetProjector added in v1.0.5

type UniversalTargetProjector struct{}

UniversalTargetProjector performs the two-pass target pipeline. It has no source-language input and delegates only syntax emission to the tested existing UAST emitter while the declarative TargetSpec controls selection.

func (UniversalTargetProjector) Analyze added in v1.0.5

func (UniversalTargetProjector) Emit added in v1.0.5

func (UniversalTargetProjector) Project added in v1.0.5

type WhileStmt

type WhileStmt struct {
	Cond Expr
	Body Stmt
}

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL