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#
|
Grammar, keyword list, intrinsic list. The source of truth for syntax. |
The numbered rules. The source of truth for behavior. |
|
Normative, but derived: it restates the rules per execution unit and adds none. |
|
Normative message text. The catalog is
generated from |
|
The command-line interface. |
|
Non-normative. Why the rules are what they are, including decisions since reversed. |
|
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.
- Grammar
- Semantic Rules
- Agents
- Resource Claims
- Context Values
- Declaration and Assignment
- Determinism
- Events
- Execution Model
- Functions
- Group Declarations
- Guards
- History Access
- If Statements
- Init Block
- Intrinsics
- Periodic Items
- Import and Export
- Model
- Observations
- Resources
- Scenarios
- Scheduling and Control
- Scoping
- State Variables
- Timing
- Types
- Zero Values
- Constraints
- Error Catalog
- Usage
- Design Rationale
- Two program modes: imperative and simulation
- Intrinsics hide simulation algorithms so modelers focus on the model
- Determinism: FIFO ordering, IEEE 754 exact comparison, no epsilon
- Per-run PRNG reseed via a keyed-hash derivation (DET-30, EXEC-30)
- Static scalar types, no aggregates
- Agents as processes alongside event handlers
- Suspension never below a call frame: agents without coroutines
claimandreleaseare separate statementsresourceas declaration keyword;rscas the type nametimeout,claim, andinithave no colon prefixinitblock for lazy agent spawningpihas noend; the asymmetry is intentionaldurationas maximum simulation time- Functions receive periodic item values as parameters, not by name (FN-35)
- Group declarations: shared body, N independent state records
schedarguments instead of event group declarations- FIFO wait queue for resource claims
- Provenance
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.
|
RC-60 and RC-70 are specified; the intrinsic is not implemented. |
Modules (MOD-i) |
|
|
Reserved. Per-sampler PRNG streams keyed (simseed, sampler, run). |
|
Reserved; reports “not yet implemented”. |
Native and GPU emitters |
|
|
Parsed and ignored; all four produce identical output. |
Non-integer |
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.