Skip to main content

Module source_parser

Module source_parser 

Source
Expand description

Source-string grammar parser — turns the user-facing source expression (e.g. "1..10", "[a, b, c]", "fib(8)") into a typed Source value.

Polydat owns the source-string grammar per the audit resolution + this design pass: SRD-18c covers the parser- layer surface conceptually, but the actual parsing lives here so all polydat consumers share one canonical source-grammar implementation.

Recognized forms:

Source textProduces
1..10IntRange { lo: 1, hi: 10, step: 1 }
1..=10IntRange { lo: 1, hi: 11, step: 1 } (inclusive end)
1..10 step 2IntRange { lo: 1, hi: 10, step: 2 }
[a, b, c]Literal { values: [Str, Str, Str] }
[1, 2, 3]Literal { values: [Int, Int, Int] }
[1.0, 2.5]Literal { values: [Float, Float] }
[true, false]Literal { values: [Bool, Bool] }
{name}WorkloadParamList { name: "name", len_hint: None }
fib(8) (or any ident(...))Generator { expr, cardinality_hint: None }
0.0..1.0ContinuousInterval { interval, measure: Uniform }

Unknown shapes return SourceParseError::Unrecognized. The consumer treats this as a parse error to surface to the workload author.

Enums§

SourceParseError
Errors that can arise during source-string parsing.

Functions§

parse_source
Parse a source-expression string into a typed Source.