Module com.darkcollective.relix.semantic


module com.darkcollective.relix.semantic
Semantic analysis for .relix scripting language source files.

This module takes a parsed Script (produced by relix-lang) and performs:

  1. Import resolution — loads all transitively imported files, detects cycles, and determines a safe processing order.
  2. Symbol collection — registers every source declaration, assignment, and def statement as a typed symbol in the symbol table.
  3. Schema inference — walks each relational algebra expression body and infers the output schema at every node.
  4. Validation — checks name resolution, function arities, schema compatibility for set operations, and source config completeness.

The entry point is SemanticAnalyzer, whose contract is Script → SemanticResult — the engine analyses an AST, and the concrete .relix text syntax is one frontend that produces one. Where a Script comes from is pluggable behind ScriptLoader; the grammar itself is not on this module's main classpath, so reading text — Relix.parse, FileSystemScriptLoader — lives in the front ends (Decision 2). Built-in functions and relations are registered via a BuiltinProvider hook passed at construction time.

Analysis always returns a SemanticResult that carries both a (possibly partial) SemanticModel and any SemanticErrors collected during analysis.