Skip to main content

Module semantics

Module semantics 

Source
Expand description

Resolved semantic types for Lemma

This module contains all types that represent resolved semantics after planning. These types are created during the planning phase and used by evaluation, inversion, etc.

Re-exports§

pub use crate::parsing::ast::ArithmeticComputation;
pub use crate::parsing::ast::ComparisonComputation;
pub use crate::parsing::ast::MathematicalComputation;
pub use crate::parsing::ast::NegationType;
pub use crate::parsing::ast::Span;
pub use crate::parsing::ast::VetoExpression;
pub use crate::parsing::source::Source;

Structs§

Data
Data: path, value, and source location.
DataPath
Resolved path to a data (created during planning from AST DataReference)
Expression
Resolved expression (all references resolved to paths, all literals typed)
LemmaType
Resolved type after planning
LiteralValue
Literal value with type. The single value type in semantics.
PathSegment
A single segment in a resolved path traversal
RatioUnit
RatioUnits
RulePath
Resolved path to a rule (created during planning from RuleReference)
ScaleUnit
ScaleUnits
SemanticDateTime
Date-time for semantic values
SemanticTime
Time-of-day for semantic values
SemanticTimezone
Timezone for semantic date/time values

Enums§

DataDefinition
Resolved data value for the execution plan: aligned with DataValue but with source per variant.
DataValue
Response/UI row for spec data: LemmaType plus optional bound literal (mirrors parse-time Definition).
ExpressionKind
Resolved expression kind (only resolved variants, no unresolved references)
LogicalComputation
Logical computation operators (defined in semantics, not used by the parser).
ReferenceTarget
What a DataDefinition::Reference copies its value from: either another data path or a rule whose result becomes this data’s value.
SemanticConversionTarget
Target unit for conversion (semantic; used by evaluation/computation). Planning converts AST ConversionTarget into this so computation does not depend on parsing. Ratio vs scale is determined by looking up the unit in the type registry’s unit index.
SemanticDurationUnit
Duration unit for semantic values (duplicated from parser to avoid parser dependency)
TypeDefiningSpec
Where the custom extension chain is rooted: same spec as this type, or imported from another resolved spec.
TypeExtends
What this type extends (primitive built-in or custom type by name).
TypeSpecification
ValueKind
Value payload (shape of a literal). No type attached. Scale unit is required; Ratio unit is optional (see plan ratio-units-optional.md).

Functions§

conversion_target_to_semantic
Convert AST conversion target to semantic (planning boundary; evaluation/computation use only semantic).
negated_comparison
Returns the logical negation of a comparison (for displaying conditions as true in explanations).
parse_number_unit
Parse a “number unit” string into a Scale or Ratio value according to the type. Caller must have obtained the TypeSpecification via unit_index from the unit in the string.
parse_value_from_string
Parse a string value according to a TypeSpecification. Used to parse runtime user input into typed values.
primitive_boolean
Primitive types use the default TypeSpecification from the parser (single source of truth).
primitive_date
primitive_duration
primitive_number
primitive_ratio
primitive_scale
primitive_text
primitive_time
type_spec_for_primitive
Map PrimitiveKind to TypeSpecification. Single source of truth for primitive type resolution.
value_to_semantic
Convert parser Value to ValueKind. Fails if Scale/Ratio have no unit (strict).