Skip to content

Norm 0.4 ​

Norm 0.4 establishes a source-authoring model backed by content-addressed Core IR. This page defines the 0.4 implementation contract; the language specification remains authoritative for syntax and type semantics.

Compilation model ​

  • .norm sources and module.norm are the project source of truth.
  • ProjectLoader creates one immutable source set for the CLI, Language Server, and test tools.
  • The value returned by module(), paths, and package headers determine project topology. If configuration evaluation fails, the Language Server still uses the directory containing module.norm as the stable project root.
  • CompilationScope carries source ownership and direct module dependencies so the analyzer and language services enforce one visibility model.
  • After name resolution and type checking, binder results flow through CoreBuilder.
  • The Language Server uses authoring snapshots; executable compilation materializes Core on demand.
  • TypedProgram, ExecutionBackend, and the Truffle lowerer consume only CoreCompilation.
  • ResolvedCall is the single source of truth for the exact target, instantiated signature, type arguments, and argument mapping.

Content identity ​

  • A DefinitionId is determined by versioned canonical bytes and fixed dependencies.
  • Callable names, parameter names, local names, and source locations do not affect equivalent callable identity.
  • Locals and type parameters use definition-local indexes.
  • Mutually recursive definitions are canonicalized as strongly connected components under one DefinitionGroupId.
  • Calls, construction, enum access, user types, and field owners contain a complete DefinitionId or a recursive-group member index.
  • Runtime-type captures are canonicalized by type-parameter index.
  • Module coordinates, nominal type arity, and observable enum text remain part of language semantics.

CoreNamespace owns authoring names and exports. CoreAuthoringMap retains names, locations, and exact reference routes for each source occurrence. Multiple occurrences can share one content definition while diagnostics and stack traces retain the executed origin.

Storage and incremental compilation ​

  • Canonical definition groups use SHA-256 content identity.
  • In-memory and file-backed DefinitionStore implementations share one minimal API.
  • File storage performs read-only validation, cross-process atomic publication, and concurrent pruning, distinguishes missing content from corrupt content, and is reused across CLI processes.
  • Typed admission results, a persisted root policy, and maintenance locks keep every process on the same capacity boundary.
  • Modules and standalone files use stable CompilationUnitId values for compilation-session history.
  • CoreDependencyIndex exposes direct dependencies, reverse dependencies, and transitive dependents.
  • CoreCompilationDelta distinguishes added, reused, and detached definitions.
  • Dependency identity propagation rekeys the changed closure while unrelated definitions retain reusable identities.

Execution and tooling ​

  • Truffle artifacts use a separate ArtifactId.
  • Artifact identity covers Core groups, the entry occurrence, the namespace/interface, binding occurrences, source content, origins, reference routes, and the backend ABI.
  • Long-running backends keep artifacts in a bounded cache.
  • ExecutionContext travels through a hidden root argument, so executable artifacts can serve independent executions safely.
  • Polyglot entry points resolve the active context at execution time.
  • Diagnostics and language services continue to use one SemanticModel and authoring identity model.
  • Core types, calls, builtin operations, namespace bindings, and the dependency closure are verified before storage.
  • Standard-library sources follow the same Core, storage, and dependency pipeline.

Executable specification ​

The suite covers identity golden bytes, source moves and renames, module versions, nominal types, declaration reordering, recursive-group canonicalization, type and call dependency propagation, authoring occurrences, corrupt and concurrent file storage, the Core-only backend, artifact reuse, Polyglot multi-context execution, and real single-file, module, and standard-library programs.

See the compiler architecture for identity and stage boundaries and the module system for project loading rules.

Norm 0.25