public interface SymbolRepository
Persistence contract for symbol storage — the extension point for a durable back-end (relational database, document store, etc.).

This interface is intentionally kept narrow: it covers the CRUD operations that a durable symbol store must support. It is not used by InMemorySymbolTable; a persistence-backed implementation of SymbolTable would delegate to a SymbolRepository.

Key structure

Relations are identified by (namespace, canonicalName) — a two-part key. Functions add a third part: the parameter signature (ordered list of ScalarType values), enabling overloading. All name comparisons must be performed on canonical (lower-cased) forms.

Design note

Symbols do not carry a generated surrogate key; the natural business key above is used as the primary key. A concrete implementation is free to add surrogate keys internally as needed by the target store.

  • Method Details

    • save

      void save(Symbol symbol)
      Persists a symbol, replacing any existing entry with the same key.
      Parameters:
      symbol - the symbol to save; must not be null
    • findRelation

      Optional<RelationSymbol> findRelation(String namespace, String canonicalName)
      Retrieves a relation symbol by its canonical key.
      Parameters:
      namespace - the namespace (canonical, lower-cased)
      canonicalName - the canonical name (lower-cased)
      Returns:
      the stored symbol, or empty if not found
    • findFunctions

      List<FunctionSymbol> findFunctions(String namespace, String canonicalName)
      Retrieves all overloads of a function by its namespace and canonical name.
      Parameters:
      namespace - the namespace (canonical, lower-cased)
      canonicalName - the canonical function name (lower-cased)
      Returns:
      all matching function symbols; never null, may be empty
    • findAll

      List<Symbol> findAll()
      Retrieves all symbols currently persisted in the repository.
      Returns:
      all symbols; never null, may be empty