feat: implement storybook DSL with template composition and validation
Add complete domain-specific language for authoring narrative content for agent simulations. Features: - Complete parser using LALRPOP + logos lexer - Template composition (includes + multiple inheritance) - Strict mode validation for templates - Reserved keyword protection - Semantic validators (trait ranges, schedule overlaps, life arcs, behaviors) - Name resolution and cross-reference tracking - CLI tool (validate, inspect, query commands) - Query API with filtering - 260 comprehensive tests (unit, integration, property-based) Implementation phases: - Phase 1 (Parser): Complete - Phase 2 (Resolution + Validation): Complete - Phase 3 (Public API + CLI): Complete BREAKING CHANGE: Initial implementation
This commit is contained in:
34
tests/examples/comparisons.sb
Normal file
34
tests/examples/comparisons.sb
Normal file
@@ -0,0 +1,34 @@
|
||||
// Test comparison expressions in life arcs
|
||||
|
||||
life_arc AgeProgression {
|
||||
state child {
|
||||
on age > 12 -> teen
|
||||
}
|
||||
state teen {
|
||||
on age >= 18 -> adult
|
||||
}
|
||||
state adult {
|
||||
on age > 65 -> senior
|
||||
}
|
||||
}
|
||||
|
||||
life_arc EnergyStates {
|
||||
state rested {
|
||||
on energy < 0.3 -> tired
|
||||
}
|
||||
state tired {
|
||||
on energy <= 0.1 -> exhausted
|
||||
}
|
||||
state exhausted {
|
||||
on energy >= 0.5 -> rested
|
||||
}
|
||||
}
|
||||
|
||||
life_arc HealthStates {
|
||||
state healthy {
|
||||
on health < 50 -> sick
|
||||
}
|
||||
state sick {
|
||||
on health >= 80 -> healthy
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user