Package com.darkcollective.relix.semantic.internal


package com.darkcollective.relix.semantic.internal
The engine-side machinery behind com.darkcollective.relix.semantic: not exported by the published artifact. What follows describes the package as a whole, as it stood before the split. Five-phase semantic analysis pipeline for Relix scripts.

Overview

This package transforms a parsed Script AST into a validated SemanticModel that downstream tools (execution engines, optimisers, IDEs) can query. Analysis is orchestrated by SemanticAnalyzer and proceeds in five sequential phases:

  1. Import Graph (ImportGraph) — resolves import statements depth-first and detects cycles.
  2. Symbol Collection (SymbolCollector) — registers every relation and function declared in all reachable scripts into an InMemorySymbolTable.
  3. Schema Inference (SchemaInferenceEngine) — walks each query body and annotates every RelNode with its inferred output Schema.
  4. Validation (SemanticValidator) — checks predicate attribute references, rename arity, join conditions, and function existence/arity.
  5. Model Assembly — produces a SemanticModel containing the namespace, symbol table, source declarations, schema annotations, and root query statements.

Key classes

SemanticAnalyzer
Entry point; call analyze(Script) to run the full pipeline.
SemanticResult
Returned by SemanticAnalyzer: carries errors and, on success, the SemanticModel.
SchemaAnnotations
Identity-keyed side-map from RelNode to inferred Schema.
FunctionCatalog
The functions a script may call, discovered from the installed libraries. A function enters the symbol table on first reference, so an analysed script carries the functions it calls rather than the whole library.
IrReport
Generates a concise ≤80 char/line IR report from a SemanticModel.

Error reporting

SemanticError carries a file path, line, column, message, and Severity. When AST nodes have been parsed with explicit source coordinates (via SourceLocation), errors are reported at the precise source position rather than the file level.

See Also: