EB Language Specification

EB Language Specification#

A domain-specific language for Monte Carlo simulation and stochastic modeling. One language expresses periodic, event, and agent models, and the compiler reduces all three to a single event-segment kernel.

This specification is self-contained. It supersedes the specification in ~/proj/eichenbank-claude/spec, which is frozen as reference — see Provenance.

What is normative#

eb.ebnf

Grammar, keyword list, intrinsic list. The source of truth for syntax.

Semantic Rules

The numbered rules. The source of truth for behavior.

Constraints

Normative, but derived: it restates the rules per execution unit and adds none.

Error Catalog

Normative message text. The catalog is generated from tests/suite.

Usage

The command-line interface.

Design Rationale

Non-normative. Why the rules are what they are, including decisions since reversed.

Provenance

Non-normative. What changed from the eichenbank-claude spec, and why.

Where this specification and spec/eb.ebnf disagree with any older document, these win. The executable suite in tests/suite pins the behavior, and ./mk spec checks that every rule cited by a test or by a source comment actually exists here.

Reading order#

For the language itself, read the grammar, then Semantic Rules. For “can I do this here?”, Constraints answers faster. For a specific diagnostic, Error Catalog.

Implementation status#

The specification leads the implementation in places. Every such place carries a NOT YET IMPLEMENTED admonition in the text; they are collected here.

:capacity(r, n)

RC-60 and RC-70 are specified; the intrinsic is not implemented.

Modules (MOD-i)

import, export, as are reserved words the compiler rejects.

sm samplers

Reserved. Per-sampler PRNG streams keyed (simseed, sampler, run).

eb repl

Reserved; reports “not yet implemented”.

Native and GPU emitters

--format native and --target are reserved. --format ebc and the VM are the supported path.

-O0 .. -O3

Parsed and ignored; all four produce identical output.

Non-integer pi periods

Rejected. See the OPEN ISSUE under PI-15.

:capacity is the one entry where the specification was changed ahead of the compiler by decision rather than by backlog: RC-60 and RC-70 are settled, and the test suite has nothing to say about them yet. The rest are ordinary “not built”.

Explicit release was in this position and no longer is — the compiler implements CLAIM-10 through CLAIM-70, and tests/suite covers crossing lifetimes, reuse through the scan, reclamation at agent termination, and the two runtime errors.