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
- Variables
- func ApplyAutomaticSemanticRepairClosure(u *UniversalASTDocument)
- func ApplySemanticClosure(u *UniversalASTDocument) error
- func ApplyUniversalTruthClosure(u *UniversalASTDocument)
- func BackendCapabilities(name string) []string
- func DependencyGap(closure SemanticClosureMatrix) int
- func EmitSemantic(target string, p *SemanticProgram) (string, error)
- func EmitSemanticDirect(target string, p *SemanticProgram) (string, error)
- func EmitSemanticPreserveOriginal(target string, p *SemanticProgram) (string, error)
- func EmpiricalPy2ManyPrimitive(astNode string) (string, bool)
- func EnrichUniversalAST(u *UniversalASTDocument) error
- func EquivalentSemanticObservations(a, b SemanticObservation) bool
- func ExactSemanticShapeIDs() []string
- func FindDirectResiduals(u *UniversalASTDocument, target string) ([]int, error)
- func GenericAtomicKernel(primitive string) (string, bool)
- func HasBackend(name string) bool
- func HasFrontend(name string) bool
- func IntermediateRouteCandidates(source, target string) []string
- func MatrixFrontendLanguages() []string
- func MissingStructuredFields(input StructuredConstructInput) []string
- func NeedsParentheses(parent, child TargetOperatorSpec, role string) bool
- func NewTranspileFailure(class FailureClass, stage, source, target string, cause error) error
- func NormalizeLanguage(name string) string
- func PhaseGap(closure SemanticClosureMatrix) int
- func PrimitiveTargetCapability(target, primitive string) (kernel string, direct bool)
- func PrimitiveTargetEmitterEvidence(target, primitive string) (kernel, emitter string, ...)
- func Run(src string) (string, error)
- func RunSemantic(program *SemanticProgram) (string, error)
- func RuntimeSource(target string) (string, error)
- func SemanticEquivalenceLibrary() (map[string][]GeneratedLoweringRecipe, error)
- func StructuredInputFields(input StructuredConstructInput) map[string]bool
- func SupportsCapability(caps []string, capability string) bool
- func SyntaxFailureSignature(diagnostic string) string
- func Transpile(target, src string) (string, error)
- func TranspileFrom(source, target, src string) (string, error)
- func TypeConversionFingerprint(t SemanticType) string
- func UASTTargetProjectionCapabilities() (map[string]map[string]PreservationMode, error)
- func UASTTargetStructureProjectionCapabilities() (map[string]map[string]PreservationMode, error)
- func UniversalLower(original *UniversalASTDocument, target string) (*UniversalASTDocument, LoweringTrace, error)
- func ValidateSemanticProgram(p *SemanticProgram) error
- func WalkSemanticDocument(doc *SemanticDocument, visitor SemanticVisitor) error
- func WriteExternalPrimitiveProofReport(out string) (int, error)
- func WriteSemanticTrace(path string, parseSuccess bool, u *UniversalASTDocument, ...) error
- func WriteUASTMatrixEngineInputs(dir string) error
- type Arg
- type AssignStmt
- type BackendSpec
- type BinaryExpr
- type BlockStmt
- type BreakStmt
- type CallExpr
- type CanonicalPrimitiveWitness
- type CapabilityMatrix
- type CapabilityResult
- type CapabilityStatus
- type CompileInputKind
- type CompileOptions
- type CompileOutputKind
- type CompileResult
- type CompilerFrontendEvidence
- type CompilerSourceEvidence
- type ContractGapClosureReport
- type DirectLoweringAnalysis
- type DirectLoweringContract
- type DirectLoweringRequirement
- type Doc
- func EmitNativeDocument(spec TargetSpec, source string) (Doc, error)
- func EmitNativeExecution(spec TargetSpec, recipe EmissionRecipe, template TargetSyntaxTemplateCell, ...) (Doc, error)
- func ExecuteEmissionRecipe(recipe EmissionRecipe, input EmissionRecipeInput, spec TargetSpec) (Doc, error)
- func ExecuteTargetSyntaxTemplate(recipe EmissionRecipe, template TargetSyntaxTemplateCell, spec TargetSpec, ...) (Doc, error)
- func NativeDeclarationEmitter(spec TargetSpec, recipe EmissionRecipe, template TargetSyntaxTemplateCell, ...) (Doc, error)
- func NativeEmitterCapabilityDoc(target, capability string, spec TargetSpec, body Doc) (Doc, error)
- func NativeExpressionEmitter(spec TargetSpec, recipe EmissionRecipe, template TargetSyntaxTemplateCell, ...) (Doc, error)
- func NativeStatementEmitter(spec TargetSpec, recipe EmissionRecipe, template TargetSyntaxTemplateCell, ...) (Doc, error)
- type DocConcat
- type DocHardLine
- type DocIndent
- type DocText
- type EmissionContractAnalysis
- type EmissionHandlerClass
- type EmissionRecipe
- type EmissionRecipeChild
- type EmissionRecipeInput
- type EmissionRecipeOperation
- type EmissionRecipeRegistry
- type EmpiricalLoweringContract
- type ExecutionPrimitiveMatrixAnalysis
- type Expr
- type ExprStmt
- type ExternalPrimitiveCrosswalkReport
- type FailureClass
- type ForStmt
- type FrontendClosureReport
- type FrontendConstructMatrixEntry
- type FrontendFactSink
- type FrontendFactsBuilder
- func (b *FrontendFactsBuilder) AddBinding(v FrontendRelationFact)
- func (b *FrontendFactsBuilder) AddField(v FrontendFieldFact)
- func (b *FrontendFactsBuilder) AddNode(v UniversalASTNode)
- func (b *FrontendFactsBuilder) AddOperand(v FrontendRelationFact)
- func (b *FrontendFactsBuilder) AddRelation(v FrontendRelationFact)
- func (b *FrontendFactsBuilder) AddRole(v FrontendRelationFact)
- func (b *FrontendFactsBuilder) AddSource(v FrontendSourceFact)
- func (b *FrontendFactsBuilder) AddSymbol(v FrontendSymbolFact)
- type FrontendFeatureEvidence
- type FrontendFieldFact
- type FrontendLanguageClosure
- type FrontendParserFormEvidence
- type FrontendParserInventory
- type FrontendPhaseEvidence
- type FrontendRelationEvidence
- type FrontendRelationFact
- type FrontendReturnFact
- type FrontendSemanticFacts
- type FrontendSourceFact
- type FrontendSpec
- type FrontendSymbolFact
- type FrontendTypeFact
- type FunctionExpr
- type FunctionFlowEvidence
- type GeneratedLoweringRecipe
- type GeneratedPrimitiveRegistry
- type GoNativeFrontend
- type HelperRequirement
- type HelperSpec
- type IdentExpr
- type IfStmt
- type ImplementationMatrix
- type IndexExpr
- type IterationEvidence
- type IterationExpr
- type Language
- type LiteralExpr
- type LoweringExactness
- type LoweringRecipeStep
- type LoweringStatus
- type LoweringTrace
- type NativeAnalysis
- type NativeEmissionInput
- type NativeEvent
- type NativeFrontend
- type NativeGoEvidenceFact
- type NativeGoNodeFact
- type NativeGoRelationFact
- type NativeGoSemanticFacts
- type NativeGoSourceFact
- type NativeGoSymbolFact
- type NativeGoTypeFact
- type NextStmt
- type OperationExpr
- type Param
- type ParsedNode
- type PreservationMode
- type PreservationRegistry
- type PreservationRule
- type PrimitiveCompilerReport
- type PrimitiveInventoryRecord
- type PrimitiveSpec
- type ProductPathWitness
- type ProjectionDerivationRule
- type ProjectionGapInformation
- type ProjectionGapInformationAnalysis
- type ProjectionGapInformationClass
- type ProjectionInformationIntegration
- type ProjectionObligationAnalysis
- type ProjectionObligationPrimitive
- type ProjectionPrimitiveReduction
- type ProjectionPrimitiveTargetSupport
- type ProjectionRendererArchetype
- type ProjectionRendererBinding
- type ProjectionRendererCatalogEntry
- type ProjectionRendererComposition
- type ProjectionRendererHarvest
- type ProjectionRendererMatch
- type ProjectionResidualAnalysis
- type ProjectionResidualCell
- type ProjectionResidualClass
- type RepeatStmt
- type RepositoryPrimitiveResolution
- type RequiredSemantics
- type Requirement
- type RequirementKind
- type RequirementRegistry
- type ReturnStmt
- type RuntimeModule
- type RuntimeModuleRegistry
- type RuntimePromotionAnalysis
- type RuntimePromotionEvidence
- type RuntimePromotionEvidenceSummary
- type RuntimeTaintCell
- type RuntimeTaintFixture
- type RuntimeTaintReport
- type SemanticArgument
- type SemanticBinding
- type SemanticCallCandidate
- type SemanticCallResolution
- type SemanticClosureMatrix
- type SemanticCompositionRecipe
- type SemanticContracts
- type SemanticDialect
- type SemanticDialectOperation
- type SemanticDocument
- type SemanticEffectSummary
- type SemanticEvidence
- type SemanticExpression
- type SemanticFeatureBasis
- type SemanticFeatureModel
- type SemanticField
- type SemanticFunction
- type SemanticNode
- type SemanticNominalRelations
- type SemanticObservation
- type SemanticOperation
- type SemanticOrigin
- type SemanticParameter
- type SemanticParameterVisitor
- type SemanticPrimitiveSpec
- type SemanticProgram
- func DecodeGenerated(source, code string) (*SemanticProgram, bool, error)
- func LiftBinaryInput(data []byte, opts CompileOptions) (*SemanticProgram, error)
- func LowerMatrixActions(source string, nodes []matrixir.CanonicalNode) (*SemanticProgram, error)
- func LowerMatrixEvents(source string, events []matrixir.CanonicalEvent) (*SemanticProgram, error)
- func LowerMatrixEventsWithFactSink(language string, events []matrixir.CanonicalEvent, sink *FrontendFactsBuilder) (*SemanticProgram, error)
- func LowerMatrixLanguage(language, source string) (*SemanticProgram, error)
- func LowerNativeGo(filename, source string) (*SemanticProgram, error)
- func LowerPython(source string) (*SemanticProgram, error)
- func LowerSource(language, filename, source string) (*SemanticProgram, error)
- func NewSemanticProgram(body *BlockStmt, evaluation string) *SemanticProgram
- func ParseSemantic(source, code string) (*SemanticProgram, error)
- func ParseSemanticCompatibility(source, code string) (*SemanticProgram, error)
- func ParseSemanticDocument(doc SemanticDocument) (*SemanticProgram, error)
- func ParseSemanticJSON(data []byte) (*SemanticProgram, error)
- func ParseUniversalASTJSON(data []byte) (*SemanticProgram, error)
- func (p *SemanticProgram) AttachSemanticFeatureProfile(source string) error
- func (p *SemanticProgram) Document() (SemanticDocument, error)
- func (p *SemanticProgram) MarshalSemanticJSON() ([]byte, error)
- func (p *SemanticProgram) MarshalUniversalASTJSON() ([]byte, error)
- func (p *SemanticProgram) RSource(enforce bool) (string, error)
- type SemanticRelationPattern
- type SemanticScope
- type SemanticSemantics
- type SemanticSourceSpan
- type SemanticStatement
- type SemanticTrace
- type SemanticTraceNode
- type SemanticTracePrimitiveDemand
- type SemanticTraceRoute
- type SemanticType
- type SemanticTypeContract
- type SemanticTypeDefinition
- type SemanticTypeEdge
- type SemanticTypeEquivalence
- type SemanticTypeRelations
- type SemanticTypeTerm
- type SemanticVisitor
- type SignatureArgument
- type SignatureBinding
- type SignatureParameter
- type Stmt
- type StructureProjectionContract
- type StructuredConstructInput
- type StructuredSemanticDemand
- type TargetCapabilityDecision
- type TargetImportSpec
- type TargetLiteralSpec
- type TargetNamingSpec
- type TargetOperatorSpec
- type TargetProjectionSpec
- type TargetSpec
- type TargetStructureSyntaxCell
- type TargetSyntaxCheck
- type TargetSyntaxTemplate
- type TargetSyntaxTemplateAnalysis
- func (a TargetSyntaxTemplateAnalysis) Cell(target, projectionClass string) (TargetSyntaxTemplateCell, bool)
- func (a TargetSyntaxTemplateAnalysis) StructureCell(target, structure string) (TargetStructureSyntaxCell, bool)
- func (a TargetSyntaxTemplateAnalysis) SupportsContract(target string, contract StructureProjectionContract, spec TargetSpec) bool
- type TargetSyntaxTemplateCell
- type TargetSyntaxTemplateForm
- type TargetTypedOperationSpec
- type TranspileFailure
- type TypeConversionRecipe
- type TypeConversionStatus
- type UASTBackendAuditReport
- type UASTBackendPath
- type UASTCapabilityPlane
- type UASTConsumerKind
- type UASTDirectExecutionItem
- type UASTDirectExecutionReport
- type UASTEndToEndCapabilityPlane
- type UASTEndToEndCapabilityReport
- type UASTExecutionAnalysis
- type UASTExecutionClass
- type UASTExecutionPrimitive
- func EmpiricalCompilerDetailExecution(primitive string) (UASTExecutionPrimitive, bool)
- func EmpiricalPy2ManyExecution(primitive string) (UASTExecutionPrimitive, bool)
- func ResolveEmpiricalPrimitive(primitive string) (UASTExecutionPrimitive, bool)
- func ResolveEmpiricalPrimitiveVector(primitives []string) []UASTExecutionPrimitive
- func ResolveObservedPrimitive(primitive string) (UASTExecutionPrimitive, bool)
- type UASTExecutionPrimitiveSpec
- type UASTExecutionRegistry
- type UASTExecutionStatus
- type UASTPreservationAnalysis
- type UASTPreservationContract
- type UASTPreservationEquivalenceClass
- type UASTPreservationPrimitive
- type UASTSourceTargetCompatibility
- type UASTStructureProjectionRegistry
- type UASTTargetBackendAudit
- type UASTTargetCapabilityMatrix
- type UASTTargetPreservationMatrix
- type UnaryExpr
- type UniversalASTBasis
- type UniversalASTCanonicalCoverage
- type UniversalASTDocument
- func ApplyPrimitiveClosure(original *UniversalASTDocument, target string) (*UniversalASTDocument, []string, error)
- func BuildCanonicalUniversalASTFromFrontendFacts(f FrontendSemanticFacts) (*UniversalASTDocument, error)
- func BuildCanonicalUniversalASTFromParseNode(language string, root *matrixir.ParseNode) (*UniversalASTDocument, error)
- func BuildRawUniversalASTFromFrontendFacts(f FrontendSemanticFacts) (*UniversalASTDocument, error)
- func ExecuteLoweringRecipe(original *UniversalASTDocument, recipe GeneratedLoweringRecipe, target string) (*UniversalASTDocument, error)
- func NewUniversalASTDocument(source string) (*UniversalASTDocument, error)
- func NormalizeUniversalAST(d *UniversalASTDocument) (*UniversalASTDocument, error)
- func ProjectSemanticDocumentToUniversal(doc SemanticDocument) (*UniversalASTDocument, error)
- type UniversalASTNode
- type UniversalASTReference
- type UniversalASTRelation
- type UniversalASTSurface
- type UniversalFormatter
- type UniversalHelperResolver
- type UniversalLoweringAnalysis
- type UniversalLoweringRule
- type UniversalTargetNameResolver
- type UniversalTargetProjector
- func (UniversalTargetProjector) Analyze(u *UniversalASTDocument, spec TargetSpec) (RequiredSemantics, TargetCapabilityDecision, error)
- func (p UniversalTargetProjector) Emit(u *UniversalASTDocument, target string) (string, error)
- func (p UniversalTargetProjector) EmitDirect(u *UniversalASTDocument, target string) (string, error)
- func (p UniversalTargetProjector) Project(u *UniversalASTDocument, spec TargetSpec) (Doc, error)
- func (p UniversalTargetProjector) ProjectDirect(u *UniversalASTDocument, spec TargetSpec) (Doc, error)
- func (p UniversalTargetProjector) ProjectLoweredDirect(u *UniversalASTDocument, spec TargetSpec) (Doc, LoweringTrace, error)
- type WhileStmt
Constants ¶
const ExactCallResolutionCapability = "call.resolution.exact.v1"
const ExactSignatureCapability = "function.signature.exact.v1"
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.
const SemanticDocumentVersion = 1
const SemanticTraceSchemaVersion = "uast-semantic-trace/v1"
Variables ¶
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", "//"},
}
var PrimitiveMatrix = []PrimitiveSpec{}/* 702 elements not displayed */
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 ApplyAutomaticSemanticRepairClosure ¶ added in v1.2.1
func ApplyAutomaticSemanticRepairClosure(u *UniversalASTDocument)
ApplyAutomaticSemanticRepairClosure is the generated-rule kernel selected by the V6 residual synthesizer. The rules are pure relation completions: they preserve existing nodes and only expose already-proved operands through the canonical syntax roles required by the existing executor.
func ApplySemanticClosure ¶ added in v1.2.1
func ApplySemanticClosure(u *UniversalASTDocument) error
ApplySemanticClosure validates and records the derived closure on the same canonical document consumed by the generic executor. It never creates a second semantic representation and it never infers meaning from source text.
func ApplyUniversalTruthClosure ¶ added in v1.2.1
func ApplyUniversalTruthClosure(u *UniversalASTDocument)
ApplyUniversalTruthClosure applies only presence implications that are already witnessed by canonical syntax relations. It never invents a value, binding, type, target, or operand identity: an explicit child relation is merely exposed through the existing data.operand relation used by the executor. The rule is language and target neutral and therefore belongs in the existing UAST enrichment pass rather than in a second semantic system.
func BackendCapabilities ¶
func DependencyGap ¶ added in v1.2.1
func DependencyGap(closure SemanticClosureMatrix) int
func EmitSemantic ¶
func EmitSemantic(target string, p *SemanticProgram) (string, error)
func EmitSemanticDirect ¶ added in v1.1.1
func EmitSemanticDirect(target string, p *SemanticProgram) (string, error)
EmitSemanticDirect is used by the intermediate-route planner. It shares the canonical semantic/UAST construction with EmitSemantic but asks the projector for a strict native result, so a route can be attempted before compatibility runtime output is considered.
func EmitSemanticPreserveOriginal ¶ added in v1.2.1
func EmitSemanticPreserveOriginal(target string, p *SemanticProgram) (string, error)
EmitSemanticPreserveOriginal is the explicit same-language surface-plane mode. The ordinary EmitSemantic path still regenerates canonical target source from UAST, while callers that request PRESERVE_ORIGINAL can return the verified original bytes without making source text part of semantics.
func EmpiricalPy2ManyPrimitive ¶ added in v1.1.1
EmpiricalPy2ManyPrimitive returns the canonical primitive for a known AST operation. Unknown operations remain unavailable and are handled by the normal compatibility path.
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 ExactSemanticShapeIDs ¶ added in v1.2.1
func ExactSemanticShapeIDs() []string
ExactSemanticShapeIDs exposes the source-independent shapes to matrix consumers. Target executability is deliberately evaluated separately.
func FindDirectResiduals ¶ added in v1.2.1
func FindDirectResiduals(u *UniversalASTDocument, target string) ([]int, error)
FindDirectResiduals returns node IDs whose canonical semantic operation is not covered by the target's direct plane. It is a conservative worklist: a node is never rewritten merely because a rule exists in the registry.
func GenericAtomicKernel ¶ added in v1.2.1
GenericAtomicKernel returns an existing productive kernel binding only when the canonical operation has a language-neutral UAST consumer. Callers must not infer a binding from a diagnostic or primitive name alone.
func HasBackend ¶
func HasFrontend ¶
func IntermediateRouteCandidates ¶ added in v1.2.1
IntermediateRouteCandidates returns only matrix-proven, cycle-free bridge targets. The generated table is compiled into the binary; no CSV parsing is performed on the transpilation hot path.
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 NewTranspileFailure ¶ added in v1.2.1
func NewTranspileFailure(class FailureClass, stage, source, target string, cause error) error
NewTranspileFailure wraps an internal cause without making the raw message part of routing or classification. The cause remains available to diagnostics and tests via errors.Unwrap/As.
func NormalizeLanguage ¶
func PhaseGap ¶ added in v1.2.1
func PhaseGap(closure SemanticClosureMatrix) int
PhaseGap and DependencyGap are intentionally derived from the populated closure axes. The current compiler evidence has no required-but-absent cells, so these remain zero without hard-coding a success result.
func PrimitiveTargetCapability ¶ added in v1.2.1
PrimitiveTargetCapability is the read-only target contract used by reports and the final closure replay. It delegates to the same capability matrix used by the productive lowering path, so a report cannot claim support from a second, hand-maintained table.
func PrimitiveTargetEmitterEvidence ¶ added in v1.2.1
func PrimitiveTargetEmitterEvidence(target, primitive string) (kernel, emitter string, exists, guardCompatible, representationCompatible, reachable bool)
PrimitiveTargetEmitterEvidence derives target support from the productive UAST renderer/template contracts. It intentionally does not consult the older capability plane: that plane describes semantic preservation, while this contract answers whether the shared target emitter can render the kernel's structural form.
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 ¶
RuntimeSource returns the actual support code embedded in generated programs. It does not contain a compiler or an external language installation.
func SemanticEquivalenceLibrary ¶ added in v1.2.1
func SemanticEquivalenceLibrary() (map[string][]GeneratedLoweringRecipe, error)
SemanticEquivalenceLibrary is a read-only view of exact alternatives. It is intentionally represented with existing recipe values rather than a second semantic IR.
func StructuredInputFields ¶ added in v1.0.6
func StructuredInputFields(input StructuredConstructInput) map[string]bool
func SupportsCapability ¶
func SyntaxFailureSignature ¶ added in v1.0.6
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 TranspileFrom ¶
TranspileFrom retains argument-evaluation semantics when the canonical syntax originated in an eager source language rather than R.
func TypeConversionFingerprint ¶ added in v1.2.1
func TypeConversionFingerprint(t SemanticType) string
TypeConversionFingerprint provides a stable key for matrix/report joins.
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 UniversalLower ¶ added in v1.2.1
func UniversalLower(original *UniversalASTDocument, target string) (*UniversalASTDocument, LoweringTrace, error)
UniversalLower applies a bounded fixed-point worklist to a private UAST clone. Every rewrite is validated before the next iteration and a graph fingerprint prevents cycles. The original document is never mutated.
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 WriteExternalPrimitiveProofReport ¶ added in v1.2.1
WriteExternalPrimitiveProofReport proves a conservative subset of the external EXACT_CODE rows against existing canonical frontend/UAST shapes.
func WriteSemanticTrace ¶ added in v1.2.1
func WriteSemanticTrace(path string, parseSuccess bool, u *UniversalASTDocument, route SemanticTraceRoute) error
WriteSemanticTrace writes atomically when path is non-empty. A nil UAST is a valid parse/UAST failure sidecar and is intentionally not an error.
func WriteUASTMatrixEngineInputs ¶ added in v1.0.5
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 AssignStmt ¶
type BackendSpec ¶
func Backends ¶
func Backends() []BackendSpec
type BinaryExpr ¶
type CallExpr ¶
type CallExpr struct {
Fun Expr
Args []Arg
Eager bool // explicit call boundary, including decoded R force wrappers
Resolution *SemanticCallResolution
}
type CanonicalPrimitiveWitness ¶ added in v1.2.1
type CanonicalPrimitiveWitness struct {
Primitive string
Kernel string
Program *SemanticProgram
}
CanonicalPrimitiveWitness is a generated, target-neutral UAST witness for a semantic primitive family. It deliberately starts below the source frontend: it exists to validate Primitive × Target backend cells which do not yet have a source-language occurrence. The resulting document is built by the normal SemanticProgram -> Canonical UAST projection and is then consumed by the unchanged primitive compiler, legalizer and emitters.
For parameterized evidence entries the witness proves the selected generic kernel and its operand wiring. It never claims that a VM/ISA spelling is a distinct source-language operation.
func BuildCanonicalPrimitiveWitness ¶ added in v1.2.1
func BuildCanonicalPrimitiveWitness(primitive string) (CanonicalPrimitiveWitness, error)
BuildCanonicalPrimitiveWitness constructs the smallest executable canonical UAST shape for the already-registered primitive kernel. It is intentionally data-driven through GenericAtomicKernel; no source or target language selects a special path here.
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 CompileInputKind ¶ added in v1.2.1
type CompileInputKind string
CompileInputKind identifies the representation supplied to the common compiler API. Source is currently the fully productive frontend; the other values are explicit capability contracts so callers cannot accidentally treat binary data as UTF-8 source.
const ( CompileInputSource CompileInputKind = "source" CompileInputAssembly CompileInputKind = "assembly" CompileInputMachine CompileInputKind = "machine_code" CompileInputObject CompileInputKind = "object" CompileInputExecutable CompileInputKind = "executable" )
type CompileOptions ¶ added in v1.2.1
type CompileOptions struct {
InputKind CompileInputKind
SourceLanguage string
SourceArch string
SourceOS string
SourceABI string
SourceAsmSyntax string
TargetArch string
TargetOS string
ABI string
OutputKind CompileOutputKind
TargetLanguage string
EntryPoint string
ViaAssembly bool
BaseAddress uint64
}
type CompileOutputKind ¶ added in v1.2.1
type CompileOutputKind string
const ( CompileSource CompileOutputKind = "source" CompileAssembly CompileOutputKind = "assembly" CompileMachineCode CompileOutputKind = "machine_code" CompileObject CompileOutputKind = "object" CompileExecutable CompileOutputKind = "executable" )
type CompileResult ¶ added in v1.2.1
type CompileResult struct {
Bytes []byte
Text string
OutputKind CompileOutputKind
InstructionCount int
AppliedRecipes []string
AllocatedLiveRanges int
}
func CompileBinaryInput ¶ added in v1.2.1
func CompileBinaryInput(data []byte, opts CompileOptions) (CompileResult, error)
func CompileMachine ¶ added in v1.2.1
func CompileMachine(p *SemanticProgram, opts CompileOptions) (CompileResult, error)
CompileMachine consumes the existing canonical document. Architecture/OS/ABI are independent options. Unsupported semantic nodes produce an error before any bytes are returned.
type CompilerFrontendEvidence ¶ added in v1.2.1
type CompilerSourceEvidence ¶ added in v1.2.1
type CompilerSourceEvidence struct{ Language, Compiler, Repository, Area, URL, LicensePolicy string }
CompilerSourceEvidence records provenance and licence constraints for facts. It is deliberately metadata only; no third-party implementation is shipped.
type ContractGapClosureReport ¶ added in v1.2.1
type ContractGapClosureReport struct {
InitialGaps int `json:"initial_contract_gaps"`
RecoveredExactContracts []string `json:"recovered_exact_contracts"`
NewDerivedPrimitives []string `json:"new_derived_primitives"`
NewGeneratedRecipes []string `json:"new_generated_recipes"`
NewRecoveredExactRules []string `json:"new_recovered_exact_rules"`
NewParameterizedAtomic []string `json:"new_parameterized_atomic_primitives"`
TrueAtomicResidual []string `json:"true_atomic_residual_primitives"`
RuntimeOnly []string `json:"runtime_only_reclassifications"`
TargetTerminal []string `json:"target_terminal_reclassifications"`
ValidationOnly []string `json:"validation_only_reclassifications"`
Aliases []string `json:"aliases"`
RemainingInsufficientEvidence []string `json:"remaining_insufficient_evidence"`
FinalContractGaps []string `json:"final_contract_gaps"`
TotalGeneratedRecipes int `json:"total_generated_recipes"`
TotalClosureReachableRules int `json:"total_closure_reachable_rules"`
TotalExecutorReachableRules int `json:"total_executor_reachable_rules"`
GenericAtomicKernelClasses []string `json:"generic_atomic_kernel_classes"`
MinimalMissingAtomicBasis []string `json:"minimal_missing_atomic_basis"`
BasisHash string `json:"basis_hash"`
ImplementationGraphRows int `json:"implementation_graph_rows"`
RecoveredEquivalenceRules int `json:"recovered_equivalence_rules"`
AtomicResidualCount int `json:"atomic_residual_count"`
}
ContractGapClosureReport records the evidence-based resolution of every contract gap. A gap without an exact repository proof is deliberately kept as INSUFFICIENT_EVIDENCE instead of being mislabeled as executable.
func WriteContractGapClosureReport ¶ added in v1.2.1
func WriteContractGapClosureReport(out string) (*ContractGapClosureReport, error)
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 DocHardLine ¶ added in v1.0.5
type DocHardLine struct{}
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
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 EmpiricalLoweringContract ¶ added in v1.1.1
type EmpiricalLoweringContract struct {
Target string
ASTNode string
Primitive string
UASTContract string
}
EmpiricalLoweringContract describes a target-independent UAST operation observed in py2many's emitters. It is deliberately a contract table, not a second IR or a parser.
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 ExternalPrimitiveCrosswalkReport ¶ added in v1.2.1
type ExternalPrimitiveCrosswalkReport struct {
InitialInsufficientEvidence int `json:"initial_insufficient_evidence"`
ExternalEvidenceRows int `json:"external_evidence_rows"`
ExactCodeEvidenceRows int `json:"exact_code_evidence_rows"`
CodeEvidenceRows int `json:"code_evidence_rows"`
DocCandidateRows int `json:"doc_candidate_rows"`
GapRowsWithExternalMatch int `json:"gap_rows_with_external_match"`
GapRowsPromotedExact int `json:"gap_rows_promoted_exact"`
NewDerivedPrimitives int `json:"new_derived_primitives"`
NewGeneratedRecipes int `json:"new_generated_recipes"`
NewParameterizedMappings int `json:"new_parameterized_kernel_mappings"`
NewTargetTerminalProofs int `json:"new_target_terminal_proofs"`
TransitivelyClosedGaps int `json:"transitively_closed_gaps"`
RemainingInsufficient int `json:"remaining_insufficient_evidence"`
TotalGeneratedRecipes int `json:"total_generated_recipes"`
TotalClosureRules int `json:"total_closure_reachable_rules"`
TotalExecutorRules int `json:"total_executor_reachable_rules"`
ExternalGapClosureRate float64 `json:"external_gap_closure_rate"`
Promoted []string `json:"promoted_exact_contracts"`
Remaining []string `json:"remaining_contracts"`
EvidenceSHA256 string `json:"evidence_sha256"`
}
func WriteExternalPrimitiveCrosswalkReport ¶ added in v1.2.1
func WriteExternalPrimitiveCrosswalkReport(out string) (*ExternalPrimitiveCrosswalkReport, error)
WriteExternalPrimitiveCrosswalkReport crosswalks the embedded workbook against the existing contract-gap and primitive registries.
type FailureClass ¶ added in v1.2.1
type FailureClass string
FailureClass is the stable, machine-readable classification exposed at the public transpilation boundary. Internal parser/compiler text is retained only as Cause and never used to choose a route.
const ( FailureSourceSyntax FailureClass = "SOURCE_SYNTAX_ERROR" FailureFrontendParse FailureClass = "FRONTEND_PARSE_BUG" FailureFrontendSemantic FailureClass = "FRONTEND_SEMANTIC_GAP" FailureLegacyParserEscape FailureClass = "LEGACY_PARSER_ESCAPE" FailureLegacyBackendEscape FailureClass = "LEGACY_BACKEND_ESCAPE" FailureUASTValidation FailureClass = "UAST_VALIDATION_FAILED" FailureLowering FailureClass = "LOWERING_INVALID_UAST" FailureIntermediate FailureClass = "INTERMEDIATE_ROUTE_FAILED" FailureRuntime FailureClass = "RUNTIME_ROUTE_FAILED" FailureRuntimeDisabled FailureClass = "RUNTIME_DISABLED" FailureTargetEmit FailureClass = "TARGET_RENDER_FAILED" FailureTargetReparse FailureClass = "TARGET_REPARSE_FAILED" FailureRegexParserEscape FailureClass = "REGEX_PARSER_ESCAPE" FailureTextParserEscape FailureClass = "TEXT_PARSER_ESCAPE" FailurePostFrontendReparse FailureClass = "POST_FRONTEND_REPARSE_ESCAPE" FailureInternal FailureClass = "INTERNAL_BUG" FailureUnknown FailureClass = "UNKNOWN_FAILURE" )
func FailureClassOf ¶ added in v1.2.1
func FailureClassOf(err error) FailureClass
type FrontendClosureReport ¶ added in v1.2.1
type FrontendClosureReport struct {
Languages []string
Forms []string
Features []string
Patterns []string
// ParserAccept is the independently inventoried source-parser axis.
// Accept is retained as a compatibility alias for callers that consumed
// the older closure report.
ParserAccept matrixir.SparseMatrix
ParserEvidence []FrontendParserFormEvidence
SourceToMatrixIR matrixir.SparseMatrix `json:"source_to_matrixir"`
MatrixIRForms []string `json:"matrixir_forms"`
PerLanguage []FrontendLanguageClosure
OldAxisForms []string
OldGenericMatrixIRAxis int `json:"old_generic_matrixir_form_axis"`
SourceParserFormUnion int `json:"true_source_parser_form_union"`
SourceParserLanguageFormCells int `json:"true_source_parser_language_form_cells"`
SourceParserGapInitial int `json:"source_parser_gap_initial"`
SourceParserGapFinal int `json:"source_parser_gap_final"`
SilentSourceParserDrop int `json:"silent_source_parser_drop"`
InvalidParserEvidenceRows int `json:"invalid_parser_evidence_rows"`
IdenticalLanguageAxisWarning bool `json:"identical_language_axis_warning"`
Accept matrixir.SparseMatrix // Language x Form
Accounted matrixir.SparseMatrix // Language x Form
Required matrixir.SparseMatrix // Form x Feature
Have matrixir.SparseMatrix // Form x Feature
RelationRequired matrixir.SparseMatrix // Form x Pattern
RelationHave matrixir.SparseMatrix // Form x Pattern
Phase matrixir.SparseMatrix // Language x phase
Dependency matrixir.SparseMatrix // Language x dependency class
NodeGap, SemanticGap, RelationGap, PhaseGap, DependencyGap int
Families []string
NodeGapInitial, NodeGapFinal int
LanguageSpecificPreserved, UnknownSemanticForms int
UnownedSurface int
StructuralComplete, SemanticComplete, CrossLanguageEmitSafe bool
OldAxisComplete bool
}
func FrontendClosureMatrices ¶ added in v1.2.1
func FrontendClosureMatrices() (FrontendClosureReport, error)
FrontendClosureMatrices derives source-parser acceptance from checked-in grammar/node evidence, then joins it to the existing canonical matrices. A missing evidence row remains unknown rather than being treated as false.
type FrontendConstructMatrixEntry ¶ added in v1.2.1
type FrontendConstructMatrixEntry struct {
Construct string `json:"construct"`
UASTStructure string `json:"uast_structure"`
UASTKind string `json:"uast_kind"`
ExecutionPrimitives []string `json:"execution_primitives"`
}
FrontendConstructMatrixEntry is the language-neutral join between a frontend construct and the UAST/execution contracts that already exist in this backend. It is metadata, not a second IR: parser events still carry the actual operands and relations.
func UniversalFrontendConstructMatrix ¶ added in v1.2.1
func UniversalFrontendConstructMatrix() []FrontendConstructMatrixEntry
UniversalFrontendConstructMatrix returns a deterministic exact join of the generated frontend crosswalk and the existing execution primitive plane. Keeping this derived from frontendFactCrosswalk prevents a second list of language handlers from drifting away from the canonical UAST contracts.
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 (b *FrontendFactsBuilder) AddRole(v FrontendRelationFact)
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 FrontendFeatureEvidence ¶ added in v1.2.1
type FrontendFieldFact ¶ added in v1.0.5
type FrontendFieldFact struct {
NodeID int
Name string
Value json.RawMessage
}
type FrontendLanguageClosure ¶ added in v1.2.1
type FrontendLanguageClosure struct {
Language string `json:"language"`
ParserForms []string `json:"parser_forms"`
AccountedForms []string `json:"accounted_forms"`
DirectCanonical []string `json:"direct_canonical"`
DesugaredCanonical []string `json:"desugared_canonical"`
CompiletimeMetadata []string `json:"compiletime_metadata"`
LanguageSpecificPreserved []string `json:"language_specific_preserved"`
RecoveredError []string `json:"recovered_error"`
NodeGaps []string `json:"node_gaps"`
UnownedSurface []string `json:"unowned_surface"`
}
type FrontendParserFormEvidence ¶ added in v1.2.1
type FrontendParserFormEvidence struct {
Language string `json:"language"`
Form string `json:"form"`
ParserSource string `json:"parser_source"`
ParserSymbol string `json:"parser_symbol"`
Origin string `json:"origin"`
Productive bool `json:"productive"`
Coverage string `json:"coverage"`
NodeNamed bool `json:"node_named"`
HasFields bool `json:"has_fields"`
HasChildren bool `json:"has_children"`
MatrixForms []string `json:"matrix_forms"`
MappingStatus string `json:"mapping_status"`
CanonicalForm string `json:"canonical_form"`
}
type FrontendParserInventory ¶ added in v1.2.1
type FrontendParserInventory struct {
Languages []string
Forms []string
Accept matrixir.SparseMatrix
Evidence []FrontendParserFormEvidence
PerLanguage map[string][]string
ByLanguage map[string]map[string]FrontendParserFormEvidence
}
func ActualFrontendParserInventory ¶ added in v1.2.1
func ActualFrontendParserInventory() FrontendParserInventory
type FrontendPhaseEvidence ¶ added in v1.2.1
type FrontendPhaseEvidence struct{ Language, Compiler, Area, Phase, Features, ID string }
type FrontendRelationEvidence ¶ added in v1.2.1
type FrontendRelationEvidence struct{ ID, Left, Relation, Right, Language, Proof, EvidenceID string }
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
Surface *UniversalASTSurface
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 FrontendTypeFact ¶ added in v1.0.5
type FrontendTypeFact struct {
NodeID int
Type SemanticType
}
type FunctionExpr ¶
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 GeneratedLoweringRecipe ¶ added in v1.2.1
type GeneratedLoweringRecipe struct {
ID string `json:"id"`
Primitive string `json:"primitive"`
Class string `json:"class"`
Dependencies []string `json:"dependencies,omitempty"`
Guards []string `json:"guards,omitempty"`
Steps []LoweringRecipeStep `json:"steps"`
BasisHash string `json:"basis_hash"`
ProofState string `json:"proof_state"`
}
GeneratedLoweringRecipe is an ephemeral rewrite plan. It contains no source program values and can safely be regenerated whenever its hash is stale.
func FindShortestExactRecipe ¶ added in v1.2.1
func FindShortestExactRecipe(target, primitive string) (GeneratedLoweringRecipe, error)
FindShortestExactRecipe performs deterministic exact witness selection over the generated equivalence library and target basis. Current recipes are single-step witnesses; the API is chain-ready for future transitive rules.
type GeneratedPrimitiveRegistry ¶ added in v1.2.1
type GeneratedPrimitiveRegistry struct {
RecipesByPrimitive map[string]GeneratedLoweringRecipe
AtomicKernels map[string]string
}
GeneratedPrimitiveRegistry is the runtime view of the generated recipes. It is derived from the canonical specification and has no language branches.
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 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 IterationEvidence ¶
type IterationExpr ¶
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 LiteralExpr ¶
type LiteralExpr struct{ Kind, Text string }
type LoweringExactness ¶ added in v1.2.1
type LoweringExactness string
LoweringExactness describes the semantic strength of a rewrite. Only EXACT rules may be applied by the native worklist; approximate/emulated candidates remain available for reports and later explicit fallback work.
const ( LoweringExact LoweringExactness = "EXACT" LoweringApproximate LoweringExactness = "APPROXIMATE" LoweringEmulated LoweringExactness = "EMULATED" )
type LoweringRecipeStep ¶ added in v1.2.1
type LoweringStatus ¶ added in v1.2.1
type LoweringStatus string
const ( LoweringDirectProven LoweringStatus = "DIRECT_PROVEN" LoweringReachable LoweringStatus = "LOWERING_REACHABLE" LoweringProven LoweringStatus = "LOWERING_PROVEN" LoweringUnresolved LoweringStatus = "UNRESOLVED" LoweringRuntimeOnly LoweringStatus = "RUNTIME_REQUIRED" )
type LoweringTrace ¶ added in v1.2.1
type LoweringTrace struct {
Target string `json:"target"`
Attempted bool `json:"attempted"`
Success bool `json:"success"`
Iterations int `json:"iterations"`
Rules []string `json:"rules,omitempty"`
Residuals []string `json:"residuals,omitempty"`
Status LoweringStatus `json:"status"`
ErrorClass string `json:"error_class,omitempty"`
BeforeDigest string `json:"before_digest,omitempty"`
AfterDigest string `json:"after_digest,omitempty"`
}
func EmitSemanticLoweredDirect ¶ added in v1.2.1
func EmitSemanticLoweredDirect(target string, p *SemanticProgram) (string, LoweringTrace, error)
EmitSemanticLoweredDirect is the explicit second stage in the native-first pipeline. It records lowering separately so a failed clone cannot leak into intermediate or runtime fallback.
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 NativeGoNodeFact ¶ added in v1.0.5
type NativeGoRelationFact ¶ added in v1.0.5
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 NativeGoTypeFact ¶ added in v1.0.5
type NativeGoTypeFact struct {
ID int
Type SemanticType
}
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 PrimitiveCompilerReport ¶ added in v1.2.1
type PrimitiveCompilerReport struct {
Specs []SemanticPrimitiveSpec `json:"specs"`
Recipes []GeneratedLoweringRecipe `json:"recipes"`
PrimitiveDependencies [][]int `json:"primitive_dependencies"`
Closure [][]int `json:"closure"`
Witness map[string]string `json:"witness"`
AtomicPrimitives []string `json:"atomic_primitives"`
KernelClasses []string `json:"kernel_classes"`
DerivedCount int `json:"derived_count"`
DerivedWithHandlers int `json:"derived_with_handlers"`
BasisHash string `json:"basis_hash"`
Inventory []string `json:"inventory"`
InventoryRecords []PrimitiveInventoryRecord `json:"inventory_records"`
ClassificationMatrix [][]int `json:"classification_matrix"`
ClassificationColumns []string `json:"classification_columns"`
DirectPrimitives []string `json:"direct_primitives"`
ParameterizedAtomic []string `json:"parameterized_atomic_primitives"`
RuntimeOnly []string `json:"runtime_only_primitives"`
ValidationOnly []string `json:"validation_only_primitives"`
Unresolved []string `json:"unresolved_primitives"`
ContractGaps []string `json:"contract_gaps"`
EquivalenceMatrix [][]int `json:"equivalence_matrix"`
RequiredPrimitiveMatrix [][]int `json:"required_primitive_matrix"`
TargetBasis map[string][]string `json:"target_basis"`
GeneratedRulesRegistered int `json:"generated_rules_registered"`
GeneratedClosureReachable int `json:"generated_rules_closure_reachable"`
GeneratedExecutorReachable int `json:"generated_rules_executor_reachable"`
KernelMatrix map[string]string `json:"kernel_matrix"`
RecoveredExactRecipes []string `json:"recovered_exact_recipes"`
}
func CompileUniversalPrimitiveSpecs ¶ added in v1.2.1
func CompileUniversalPrimitiveSpecs() (*PrimitiveCompilerReport, error)
CompileUniversalPrimitiveSpecs is the single entry point for generated semantic lowering data. It performs deterministic dependency closure and records witnesses; callers do not need a second registry.
func WritePrimitiveCompilerReport ¶ added in v1.2.1
func WritePrimitiveCompilerReport(out string) (*PrimitiveCompilerReport, error)
func (*PrimitiveCompilerReport) Registry ¶ added in v1.2.1
func (r *PrimitiveCompilerReport) Registry() GeneratedPrimitiveRegistry
type PrimitiveInventoryRecord ¶ added in v1.2.1
type PrimitiveInventoryRecord struct {
ID string `json:"id"`
Source string `json:"source"`
Class string `json:"class"`
SpecPresent bool `json:"spec_present"`
DependenciesKnown bool `json:"dependencies_known"`
RecipeGenerated bool `json:"recipe_generated"`
RuleRegistered bool `json:"rule_registered"`
ClosureReachable bool `json:"closure_reachable"`
ExecutorReachable bool `json:"executor_reachable"`
TargetTerminalReachable bool `json:"target_terminal_reachable"`
SpecializedHandlerRequired bool `json:"specialized_handler_required"`
Status string `json:"status"`
Reason string `json:"reason,omitempty"`
}
type PrimitiveSpec ¶
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
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 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
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 ProjectionRendererBinding ¶ added in v1.0.5
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
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 RepositoryPrimitiveResolution ¶ added in v1.2.1
type RepositoryPrimitiveResolution struct {
ID, Status, Kernel string
}
RepositoryPrimitiveResolution is the terminal, data-driven classification used by the repository-wide primitive handoff. It binds candidate semantics to existing kernels or shared helper families without adding UAST nodes.
func ResolveRepositoryPrimitive ¶ added in v1.2.1
func ResolveRepositoryPrimitive(id, family, scope, handler string) RepositoryPrimitiveResolution
ResolveRepositoryPrimitive returns one of the handoff's five terminal states. The decision uses structured candidate metadata only.
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 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
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 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 SemanticClosureMatrix ¶ added in v1.2.1
type SemanticClosureMatrix struct {
Languages []string
CanonicalForms []string
Features []string
Relations []string
DependencyKinds []string
PhaseKinds []string
MLang matrixir.SparseMatrix
MUAST matrixir.SparseMatrix
MFrontend matrixir.SparseMatrix
MRel matrixir.SparseMatrix
MObserved matrixir.SparseMatrix
MCompose matrixir.SparseMatrix
MDep matrixir.SparseMatrix
MPhase matrixir.SparseMatrix
RelationPatterns []SemanticRelationPattern
Composition []SemanticCompositionRecipe
CompilerEvidence []CompilerFrontendEvidence
FrontendFeatures []FrontendFeatureEvidence
FrontendPhases []FrontendPhaseEvidence
FrontendRelations []FrontendRelationEvidence
CompilerSources []CompilerSourceEvidence
}
func SemanticClosureMatrices ¶ added in v1.2.1
func SemanticClosureMatrices() (SemanticClosureMatrix, error)
SemanticClosureMatrices returns the cached, matrix-derived closure used by all frontends. It is intentionally cheap after the first call.
type SemanticCompositionRecipe ¶ added in v1.2.1
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 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 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 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 SemanticPrimitiveSpec ¶ added in v1.2.1
type SemanticProgram ¶
type SemanticProgram struct {
// CompatibilityR is a generated diagnostic view retained for callers that
// still execute the matrix language's canonical compatibility form. It is
// produced by the modern MatrixIR frontend; it is never used as semantic
// input by emitters or by TranspileCore.
CompatibilityR string `json:"-"`
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 LiftBinaryInput ¶ added in v1.2.1
func LiftBinaryInput(data []byte, opts CompileOptions) (*SemanticProgram, error)
LiftBinaryInput exposes the same canonical SemanticProgram used by source inputs for a straight-line integer subset. The recovery is dataflow based: register definitions are represented as canonical expressions and a return is recovered only when every instruction on the path has a proven semantic transfer. No opcode spelling is promoted to a source-language construct.
func LowerMatrixActions ¶
func LowerMatrixActions(source string, nodes []matrixir.CanonicalNode) (*SemanticProgram, error)
LowerMatrixActions is an explicit compatibility bridge. 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.
It is retained for old action-stream callers and is not a productive source entry point. Source-specific modern frontends must produce structured facts and call LowerMatrixLanguage instead.
func LowerMatrixEvents ¶
func LowerMatrixEvents(source string, events []matrixir.CanonicalEvent) (*SemanticProgram, error)
LowerMatrixEvents is an explicit compatibility adapter for legacy callers; the productive source path consumes CanonicalSemanticEvents directly in LowerMatrixLanguage and never reparses Event.Text.
func LowerMatrixEventsWithFactSink ¶ added in v1.0.5
func LowerMatrixEventsWithFactSink(language string, events []matrixir.CanonicalEvent, sink *FrontendFactsBuilder) (*SemanticProgram, error)
LowerMatrixEventsWithFactSink is an explicit compatibility bridge for callers that still provide event text. It is never called by LowerSource or the product TranspileCore path. New frontends must use materializeStructuredMatrixFacts through LowerMatrixLanguage.
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 LowerSource ¶ added in v1.2.1
func LowerSource(language, filename, source string) (*SemanticProgram, error)
LowerSource is the sole source-to-UAST frontend selector used by the product. Frontends may use different parser implementations, but every successful implementation returns the same canonical UniversalASTDocument. A native structured frontend is attempted where one is registered; the matrix frontend is the language-neutral fallback. Neither branch invokes a text/regex semantic parser or a legacy AST adapter.
func NewSemanticProgram ¶
func NewSemanticProgram(body *BlockStmt, evaluation string) *SemanticProgram
func ParseSemantic ¶
func ParseSemantic(source, code string) (*SemanticProgram, error)
ParseSemantic is kept as a source-compatible alias for older callers. New product code must use LowerSource so text parsing cannot re-enter the canonical frontend after structured facts have been produced. Deprecated: use LowerSource for production and ParseSemanticCompatibility only for explicit compatibility/oracle work.
func ParseSemanticCompatibility ¶ added in v1.2.1
func ParseSemanticCompatibility(source, code string) (*SemanticProgram, error)
ParseSemanticCompatibility is the explicit legacy text ingress retained for compatibility fixtures and oracle tooling. The productive source path is LowerSource, which never calls this function.
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.
type SemanticRelationPattern ¶ added in v1.2.1
type SemanticScope ¶
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 SemanticTrace ¶ added in v1.2.1
type SemanticTrace struct {
SchemaVersion string `json:"schema_version"`
ParseSuccess bool `json:"parse_success"`
UASTSuccess bool `json:"uast_success"`
UASTHash string `json:"uast_hash,omitempty"`
Nodes []SemanticTraceNode `json:"nodes"`
PrimitiveDemands []SemanticTracePrimitiveDemand `json:"primitive_demands,omitempty"`
Route SemanticTraceRoute `json:"route"`
// FrontendEvidence is provenance from the same canonical UAST closure. It
// lets downstream matrix tooling distinguish observed compiler facts from
// ordinary UAST demand without deriving semantics from source or diagnostics.
FrontendEvidence map[string]any `json:"frontend_evidence,omitempty"`
}
func BuildSemanticTrace ¶ added in v1.2.1
func BuildSemanticTrace(parseSuccess bool, u *UniversalASTDocument, route SemanticTraceRoute) SemanticTrace
BuildSemanticTrace materializes the same structured sidecar document used by the miner without performing target projection. This is the discovery-only entry point: every primitive comes from the canonical UAST itself.
type SemanticTraceNode ¶ added in v1.2.1
type SemanticTraceNode struct {
NodeID string `json:"node_id"`
ParentNodeID string `json:"parent_node_id"`
NodeKind string `json:"node_kind"`
SemanticOperation string `json:"semantic_operation"`
SemanticFamily string `json:"semantic_family"`
Arity int `json:"arity"`
OperandRoles string `json:"operand_roles"`
ResultRole string `json:"result_role"`
TypeModel string `json:"type_model"`
NumericModel string `json:"numeric_model"`
Effects string `json:"effects"`
EvaluationOrder string `json:"evaluation_order"`
Binding string `json:"binding"`
Scope string `json:"scope"`
Ownership string `json:"ownership"`
Lifetime string `json:"lifetime"`
Representation string `json:"representation"`
ControlFlow string `json:"control_flow"`
MemoryBehavior string `json:"memory_behavior"`
ExceptionBehavior string `json:"exception_behavior"`
PrimitiveID string `json:"primitive_id,omitempty"`
PrimitiveFamily string `json:"primitive_family,omitempty"`
Parameterization string `json:"parameterization,omitempty"`
LanguageOperation string `json:"language_operation"`
SourceStart string `json:"source_start"`
SourceEnd string `json:"source_end"`
}
type SemanticTracePrimitiveDemand ¶ added in v1.2.1
type SemanticTraceRoute ¶ added in v1.2.1
type SemanticTraceRoute struct {
RouteType string `json:"route_type"`
ProjectionMode string `json:"projection_mode,omitempty"`
RuntimeFallbackUsed bool `json:"runtime_fallback_used"`
DirectSuccess bool `json:"direct_success"`
PrimitiveLoweringSuccess bool `json:"primitive_lowering_success"`
IntermediateSuccess bool `json:"intermediate_success"`
IntermediateLanguage string `json:"intermediate_language,omitempty"`
IntermediateRoute string `json:"intermediate_route,omitempty"`
Leg1CaseID string `json:"leg1_case_id,omitempty"`
Leg2CaseID string `json:"leg2_case_id,omitempty"`
Leg1InputHash string `json:"leg1_input_hash,omitempty"`
Leg1OutputHash string `json:"leg1_output_hash,omitempty"`
Leg2InputHash string `json:"leg2_input_hash,omitempty"`
Leg2OutputHash string `json:"leg2_output_hash,omitempty"`
RootUASTHash string `json:"root_uast_hash,omitempty"`
IntermediateUASTHash string `json:"intermediate_uast_hash,omitempty"`
FinalUASTHash string `json:"final_uast_hash,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 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 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 StructuredSemanticDemand ¶ added in v1.2.1
type StructuredSemanticDemand struct {
UASTHash string
Nodes []string
Operations []string
Primitives []string
Kernels []string
Types []string
Effects []string
Evaluation []string
Bindings []string
Ownership []string
Representation []string
}
StructuredSemanticDemand is derived only from canonical UAST nodes and facets. Diagnostics are deliberately absent from this type.
func AnalyzeStructuredSemanticDemand ¶ added in v1.2.1
func AnalyzeStructuredSemanticDemand(u *UniversalASTDocument) StructuredSemanticDemand
AnalyzeStructuredSemanticDemand creates the case x primitive input matrix. It is the only supported demand classifier for corpus evidence.
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 TargetLiteralSpec ¶ added in v1.0.5
type TargetNamingSpec ¶ added in v1.0.5
type TargetOperatorSpec ¶ added in v1.0.5
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
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 TranspileFailure ¶ added in v1.2.1
type TranspileFailure struct {
Class FailureClass
Stage string
Source string
Target string
Reason string
Cause error
}
TranspileFailure is the typed error crossing the public source-to-target boundary. Callers can inspect Class without parsing diagnostic strings.
func (*TranspileFailure) Error ¶ added in v1.2.1
func (f *TranspileFailure) Error() string
func (*TranspileFailure) Unwrap ¶ added in v1.2.1
func (f *TranspileFailure) Unwrap() error
type TypeConversionRecipe ¶ added in v1.2.1
type TypeConversionRecipe struct {
ID string `json:"id"`
FromKind string `json:"from_kind"`
ToKind string `json:"to_kind"`
Target string `json:"target"`
Guard []string `json:"guard,omitempty"`
PreservationClass LoweringExactness `json:"preservation_class"`
Status TypeConversionStatus `json:"status"`
}
TypeConversionRecipe describes one canonical type conversion witness. It contains no target AST or intermediate representation.
func ResolveUniversalTypeConversion ¶ added in v1.2.1
func ResolveUniversalTypeConversion(from, to SemanticType, target string) (TypeConversionRecipe, error)
ResolveUniversalTypeConversion proves an exact conversion recursively. It returns TYPE_CONVERSION_UNRESOLVED for incomplete, unknown, or lossy pairs.
func UniversalTypeConversionRegistry ¶ added in v1.2.1
func UniversalTypeConversionRegistry() []TypeConversionRecipe
UniversalTypeConversionRegistry is the data-driven registry for exact structural conversions. Target names are metadata for emitters; validity is proven from the canonical source/target type pair, never guessed from source spelling.
type TypeConversionStatus ¶ added in v1.2.1
type TypeConversionStatus string
TypeConversionStatus is deliberately separate from renderer selection. A conversion is usable by UniversalLowering only when its structural contract is exact; unknown source information never gets coerced to a convenient target type.
const ( TypeConversionExact TypeConversionStatus = "EXACT" TypeConversionUnresolved TypeConversionStatus = "TYPE_CONVERSION_UNRESOLVED" )
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 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 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.
func EmpiricalCompilerDetailExecution ¶ added in v1.1.1
func EmpiricalCompilerDetailExecution(primitive string) (UASTExecutionPrimitive, bool)
EmpiricalCompilerDetailExecution keeps compiler/bytecode-only observations on the existing validation path. They are useful contracts but do not imply a new executable UAST semantic.
func EmpiricalPy2ManyExecution ¶ added in v1.1.1
func EmpiricalPy2ManyExecution(primitive string) (UASTExecutionPrimitive, bool)
EmpiricalPy2ManyExecution links an observed py2many primitive to the existing productive UAST execution handler.
func ResolveEmpiricalPrimitive ¶ added in v1.1.1
func ResolveEmpiricalPrimitive(primitive string) (UASTExecutionPrimitive, bool)
ResolveEmpiricalPrimitive is the common bridge used by evidence consumers for both compiler and py2many primitive names.
func ResolveEmpiricalPrimitiveVector ¶ added in v1.1.1
func ResolveEmpiricalPrimitiveVector(primitives []string) []UASTExecutionPrimitive
ResolveEmpiricalPrimitiveVector resolves a composed evidence signature to the unique set of existing productive handlers. Ambiguous source evidence therefore remains a composition of normal UAST consumers rather than a new primitive or language-specific path.
func ResolveObservedPrimitive ¶ added in v1.1.1
func ResolveObservedPrimitive(primitive string) (UASTExecutionPrimitive, bool)
ResolveObservedPrimitive is the shared evidence bridge used by the all-to-all matrix. It links observed semantic names to productive handlers while leaving parser-only operations to their existing machine handlers.
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
func (m UASTTargetPreservationMatrix) Status(row, col int) PreservationMode
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"`
// Surface is the lossless source plane. It carries original bytes only;
// semantic lowering continues to use Nodes/Relations as the sole semantic
// representation. Same-language preservation can therefore round-trip
// source without reparsing or inventing a second IR.
Surface *UniversalASTSurface `json:"surface,omitempty"`
Nodes []UniversalASTNode `json:"nodes"`
Relations []UniversalASTRelation `json:"relations"`
}
func ApplyPrimitiveClosure ¶ added in v1.2.1
func ApplyPrimitiveClosure(original *UniversalASTDocument, target string) (*UniversalASTDocument, []string, error)
ApplyPrimitiveClosure is the productive bridge from canonical UAST to the generated recipe executor. A recipe is applied only when the document has a matching canonical operation. Non-matches are already validated when the compiler constructs the recipe, so cloning the complete UAST for every unrelated recipe would add quadratic work without strengthening the productive contract.
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 ExecuteLoweringRecipe ¶ added in v1.2.1
func ExecuteLoweringRecipe(original *UniversalASTDocument, recipe GeneratedLoweringRecipe, target string) (*UniversalASTDocument, error)
ExecuteLoweringRecipe validates and applies a generated recipe to a private UAST clone. The generic executor records the recipe provenance and leaves semantic payloads untouched when a target already supports the node.
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 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 UniversalASTSurface ¶ added in v1.2.1
type UniversalASTSurface struct {
Language string `json:"language"`
Encoding string `json:"encoding"`
SHA256 string `json:"sha256"`
ByteLength int `json:"byte_length"`
BytesBase64 string `json:"bytes_base64"`
}
func NewUniversalASTSurface ¶ added in v1.2.1
func NewUniversalASTSurface(language, source string) *UniversalASTSurface
func (*UniversalASTSurface) Bytes ¶ added in v1.2.1
func (s *UniversalASTSurface) Bytes() ([]byte, error)
type UniversalFormatter ¶ added in v1.0.5
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 UniversalLoweringAnalysis ¶ added in v1.2.1
type UniversalLoweringAnalysis struct {
Schema string `json:"schema"`
Rules []UniversalLoweringRule `json:"rules"`
FrontendProvenSemantics []string `json:"frontend_proven_semantics"`
DirectTargetCells int `json:"direct_target_cells"`
LoweringReachableCells int `json:"lowering_reachable_cells"`
LoweringProvenCells int `json:"lowering_proven_cells"`
ResidualCells int `json:"residual_cells"`
RuntimeOnlyCells int `json:"runtime_only_cells"`
UnknownCells int `json:"unknown_cells"`
MaxLoweringDepth int `json:"max_lowering_depth"`
CyclesDetected int `json:"cycles_detected"`
PerTarget map[string]map[string]int `json:"per_target"`
}
func AnalyzeUniversalLowering ¶ added in v1.2.1
func AnalyzeUniversalLowering() (UniversalLoweringAnalysis, error)
AnalyzeUniversalLowering derives a compact report from the existing UAST capability matrix and rule registry. It does not promote a rule to proven support; proven counts are populated only by successful executable witnesses.
func WriteUniversalLoweringAnalysis ¶ added in v1.2.1
func WriteUniversalLoweringAnalysis(out string) (UniversalLoweringAnalysis, error)
WriteUniversalLoweringAnalysis writes the requested report plane. CSVs are deterministic and contain only registry/matrix evidence; summary.json is the machine-readable aggregate.
type UniversalLoweringRule ¶ added in v1.2.1
type UniversalLoweringRule struct {
ID string `json:"id"`
SourceSemantic string `json:"source_semantic"`
ResultSemantics []string `json:"result_semantics"`
RequiredCapabilities []string `json:"required_capabilities,omitempty"`
RequiredTypes []string `json:"required_types,omitempty"`
RequiredEffects []string `json:"required_effects,omitempty"`
RequiredContracts []string `json:"required_contracts,omitempty"`
RequiredRelations []string `json:"required_relations,omitempty"`
RepresentationGuards []string `json:"representation_guards,omitempty"`
ForbiddenEffects []string `json:"forbidden_effects,omitempty"`
TargetGuards []string `json:"target_guards,omitempty"`
PreservationClass LoweringExactness `json:"preservation_class"`
EvidenceStatus string `json:"evidence_status"`
Implemented bool `json:"implemented"`
ComplexityBefore int `json:"complexity_before"`
ComplexityAfter int `json:"complexity_after"`
// Applier is intentionally not serialized. It is only used after all
// declarative guards have passed and receives a mutable UAST clone.
Applier func(*UniversalASTDocument, int) error `json:"-"`
}
UniversalLoweringRule is a source-independent semantic rewrite contract. SourceSemantic is a canonical UAST semantic kind or operation identifier; ResultSemantics names the existing UAST kinds/operations produced by the rule. RequiredCapabilities are checked against the target's existing direct capability plane before an applier is run.
func GeneratedUniversalLoweringRules ¶ added in v1.2.1
func GeneratedUniversalLoweringRules() ([]UniversalLoweringRule, error)
GeneratedUniversalLoweringRules exposes the CSV-derived recipes through the same rule shape used by the existing worklist. Callers may merge these rules with the static evidence registry without introducing another IR or handler table.
func UniversalLoweringRegistry ¶ added in v1.2.1
func UniversalLoweringRegistry() []UniversalLoweringRule
UniversalLoweringRegistry is the single executable rule view consumed by the worklist: evidence-backed static rules plus generated recipe rules.
func UniversalLoweringRules ¶ added in v1.2.1
func UniversalLoweringRules() []UniversalLoweringRule
UniversalLoweringRules is the single registry used by closure analysis and the executable worklist. The entries are the evidence-backed, source independent contracts from the lowering matrix. Only entries marked Implemented and EXACT are executable; the remaining contracts deliberately stay visible as unresolved work instead of being guessed.
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) Analyze(u *UniversalASTDocument, spec TargetSpec) (RequiredSemantics, TargetCapabilityDecision, error)
func (UniversalTargetProjector) Emit ¶ added in v1.0.5
func (p UniversalTargetProjector) Emit(u *UniversalASTDocument, target string) (string, error)
func (UniversalTargetProjector) EmitDirect ¶ added in v1.1.1
func (p UniversalTargetProjector) EmitDirect(u *UniversalASTDocument, target string) (string, error)
func (UniversalTargetProjector) Project ¶ added in v1.0.5
func (p UniversalTargetProjector) Project(u *UniversalASTDocument, spec TargetSpec) (Doc, error)
func (UniversalTargetProjector) ProjectDirect ¶ added in v1.1.1
func (p UniversalTargetProjector) ProjectDirect(u *UniversalASTDocument, spec TargetSpec) (Doc, error)
ProjectDirect is the strict counterpart used by the matrix route planner. It performs the same structural and capability validation but never selects compatibility runtime output. A caller can therefore try an intermediate target and only invoke the normal Project method as the final fallback.
func (UniversalTargetProjector) ProjectLoweredDirect ¶ added in v1.2.1
func (p UniversalTargetProjector) ProjectLoweredDirect(u *UniversalASTDocument, spec TargetSpec) (Doc, LoweringTrace, error)
ProjectLoweredDirect is the explicit second stage after ProjectDirect. It owns the private UAST clone and returns only a runtime-free native document.
Source Files
¶
- automatic_semantic_repair.go
- backend.go
- binary_frontend.go
- binding_matrix.go
- call_matrix.go
- call_resolution.go
- capability_matrix.go
- codegen_generic.go
- contract_gap_closure.go
- direct_lowering_contracts_generated.go
- eager_r.go
- effect_summary.go
- emission_recipes_generated.go
- expression_matrix.go
- external_primitive_crosswalk.go
- external_primitive_proof.go
- failure.go
- flow_matrix.go
- frontend_closure_matrix.go
- frontend_compiler_evidence.go
- frontend_construct_matrix.go
- frontend_fact_crosswalk_generated.go
- frontend_fact_parser.go
- frontend_facts.go
- frontend_lower.go
- frontend_parser_inventory.go
- frontend_structural_closure.go
- generated_decode.go
- ident.go
- implementation_matrix.go
- integer_codegen.go
- integer_cpp_codegen.go
- integer_native_codegen.go
- integer_value.go
- intermediate_route_matrix_generated.go
- iteration_matrix.go
- iteration_runtime.go
- machine_compile.go
- machine_float.go
- machine_image.go
- machine_registers.go
- machine_x64.go
- matrix_generated.go
- modern_frontend.go
- native_emitter.go
- native_emitter_capabilities.go
- native_frontend.go
- native_go_facts.go
- native_go_integer.go
- native_go_lower.go
- nim_runtime.go
- parse_node_projection.go
- parser.go
- primitive_compiler.go
- primitive_witness.go
- projection_renderer_compositions_generated.go
- projection_renderers_generated.go
- py2many_contracts.go
- registry.go
- repository_primitives.go
- runtime.go
- runtime_taint.go
- runtime_taint_matrix.go
- runtime_uast.go
- runtime_uast_primitives.go
- semantic_closure.go
- semantic_document.go
- semantic_equivalence.go
- semantic_feature_space.go
- semantic_program.go
- semantic_source.go
- semantic_trace.go
- semantic_validation.go
- semantic_walk.go
- signature_binding.go
- signature_contract.go
- signature_runtime.go
- state_matrix.go
- structured_construct.go
- structured_demand.go
- target_syntax_check.go
- target_syntax_templates_generated.go
- targets.go
- type_conversion_registry.go
- type_equivalence.go
- type_nominal.go
- type_relations.go
- typed_adapter_matrix.go
- typed_operation.go
- uast_canonical_coverage.go
- uast_capability.go
- uast_direct.go
- uast_direct_lowering.go
- uast_direct_report.go
- uast_emission_contracts.go
- uast_emission_recipes.go
- uast_end_to_end_capability.go
- uast_evidence.go
- uast_execution_primitives.go
- uast_execution_registry.go
- uast_function_flow.go
- uast_inline.go
- uast_matrix_engine_adapter.go
- uast_preservation_analysis.go
- uast_projection_derivation.go
- uast_projection_gap_classification.go
- uast_projection_obligations.go
- uast_projection_reduction.go
- uast_projection_residual.go
- uast_r_writer.go
- uast_renderer_harvest.go
- uast_runtime_promotion.go
- uast_runtime_promotion_evidence.go
- uast_structure_projection.go
- uast_target_codegen.go
- uast_target_entry.go
- uast_target_preservation_matrix.go
- uast_target_syntax_templates.go
- universal_ast.go
- universal_ast_projection.go
- universal_lowering.go
- universal_target_projector.go
- universal_truth_closure.go
- v6_evidence_generated.go
- v8_delta_evidence_generated.go