Skip to main content

Crate lemma

Crate lemma 

Source
Expand description

§Lemma Engine

Rules for man and machine

Consumer API: loadlistshow / sourcerun.

Modules§

deps
Dependency layout under <workdir>/lemma_deps/, shared by CLI fetch and LSP.

Structs§

Cause
Context
Ordered store of specs keyed by (repository, name) and grouped into LemmaSpecSets.
DataEntry
One data entry in a Show.
DataPath
Resolved path to a data (created during planning from AST DataReference)
DateTimeValue
Engine
Engine for evaluating Lemma rules.
ErrorDetails
Detailed error information with optional source location.
Errors
Load failure: errors plus the source texts we attempted to load.
Explanation
LemmaBase
The LemmaBase registry fetches Lemma source text from LemmaBase.
LemmaRepository
A Lemma repository header. Identity carrier; never owns specs.
LemmaSpec
A Lemma spec containing data and rules.
LemmaSpecSet
All spec versions sharing a (repository, name) identity, keyed by effective_from.
LemmaType
Resolved type after planning
Lexer
ListedSpec
Listed spec row from Engine::list.
LiteralValue
Literal value with type. The single value type in semantics.
MeasureUnit
A single unit within a Measure type.
MeasureUnits
ParseResult
RatioUnit
RatioUnits
RegistryBundle
A bundle of Lemma source text returned by the Registry.
RegistryError
An error returned by a Registry implementation.
ResolvedRepository
Repository group from Engine::list.
ResourceLimits
Limits to prevent abuse and enable predictable resource usage
Response
Response from evaluating a Lemma spec
RuleResult
Result of evaluating a single rule. Struct fields match the API JSON shape.
SerializedConversionTraceStep
Show
Consumer [Engine::show] result: data used by the spec’s rules, local rule result types, and resolved temporal window. Source: [Engine::source].
ShowVersion
Half-open [effective_from, effective_to) for one loaded temporal row.
Source
Positional source location: source id and span.
Span
Span representing a location in source code
SpecRef
A spec reference written in source.
TimezoneValue

Enums§

BindingDataValue
Response row for spec data: type, plan metadata, and committed binding from overlay or spec literal.
ConversionTraceRole
DataValue
Parse-time data value (before type resolution)
DataValueInput
Typed data value from a client (CLI/WASM). JSON parsing stays outside [parse_data_value].
DateGranularity
Error
Error types for the Lemma system with source location tracking
ErrorKind
Classification of an Error. Serialized as the kind field on the flat object returned to JavaScript from WASM (engine/src/wasm.rs, JsError).
ExplanationNode
OperationResult
Result of an operation (evaluating a rule or expression) TODO: Rename. This can also represent a data value.
RegistryErrorKind
The kind of failure that occurred during a Registry operation.
RequestErrorKind
Distinguishes HTTP 404 (not found) from 400 (bad request) for request errors.
SourceType
TokenKind
TypeSpecification
ValueKind
Value payload (shape of a literal). No type attached. Measure unit is required; Ratio unit is optional (see plan ratio-units-optional.md).
VetoType
Why an operation yielded no value (domain veto).

Constants§

EMBEDDED_STDLIB_REPOSITORY
Repository name reserved for the embedded standard library (repo lemma, spec units). User Engine::load must not target this name via SourceType::Dependency.
MAX_DATA_NAME_LENGTH
MAX_RULE_NAME_LENGTH
MAX_SPEC_NAME_LENGTH
UNITS_LEMMA

Traits§

Registry
Trait for resolving external repository references.

Functions§

format_explanation
format_parse_result
Format a ParseResult (repository groups + specs) into canonical Lemma source.
format_source
Parse a source string and format it to canonical Lemma source.
format_specs
Format a sequence of parsed specs into canonical Lemma source.
parse
parse_spec_set_id
Validate and normalize a spec set identifier (a workspace spec name).
resolve_effective
Resolve an optional effective datetime string for planning or evaluation.
resolve_registry_references
Resolve every uses reference that carries a registry repository qualifier in the loaded specs.
try_parse_type_constraint_command
Parses a constraint command name. Returns None for unknown (parser returns error).
type_detail_lines
Produce a human-readable summary of type constraints, or None when there are no constraints worth showing (e.g. bare boolean). Returns one formatted string per constraint or property of the type specification. Uses display_str for all rational bounds so they render as decimals, not as raw fractions.