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§
- Expression
- Resolved expression (all references resolved to paths, all literals typed)
- Fact
- Fact: path, value, and source location.
- Fact
Path - Resolved path to a fact (created during planning from AST FactReference)
- Lemma
Type - Resolved type after planning
- Literal
Value - Literal value with type. The single value type in semantics.
- Path
Segment - A single segment in a resolved path traversal
- Ratio
Unit - Ratio
Units - Rule
Path - Resolved path to a rule (created during planning from RuleReference)
- Scale
Unit - Scale
Units - Semantic
Date Time - Date-time for semantic values
- Semantic
Time - Time-of-day for semantic values
- Semantic
Timezone - Timezone for semantic date/time values
Enums§
- Expression
Kind - Resolved expression kind (only resolved variants, no unresolved references)
- Fact
Data - Resolved fact value for the execution plan: aligned with
FactValuebut with source per variant. - Fact
Value - Fact value: literal, type declaration (resolved type only), or spec reference.
- Logical
Computation - Logical computation operators (defined in semantics, not used by the parser).
- Semantic
Conversion Target - 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.
- Semantic
Duration Unit - Duration unit for semantic values (duplicated from parser to avoid parser dependency)
- Type
Extends - What this type extends (primitive built-in or custom type by name).
- Type
Specification - Value
Kind - 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 - value_
to_ semantic - Convert parser Value to ValueKind. Fails if Scale/Ratio have no unit (strict).