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:
37
tests/examples/use_statements.sb
Normal file
37
tests/examples/use_statements.sb
Normal file
@@ -0,0 +1,37 @@
|
||||
// Test use statement syntax
|
||||
// Note: Multi-file resolution not yet implemented,
|
||||
// but syntax is parsed and validated
|
||||
|
||||
// Single import - import one specific item
|
||||
use characters::Martha;
|
||||
use templates::GenericPerson;
|
||||
use enums::BondType;
|
||||
|
||||
// Grouped import - import multiple items from same module
|
||||
use characters::{David, Tommy, Elena};
|
||||
use behaviors::{WorkAtBakery, SocialInteraction, DailyRoutine};
|
||||
|
||||
// Wildcard import - import everything from a module
|
||||
use locations::*;
|
||||
use schedules::*;
|
||||
|
||||
// Nested paths work too
|
||||
use world::characters::npcs::Merchant;
|
||||
use schema::core::needs::Hunger;
|
||||
|
||||
// After imports, define local declarations
|
||||
character LocalCharacter {
|
||||
age: 25
|
||||
name: "Local Person"
|
||||
}
|
||||
|
||||
template LocalTemplate {
|
||||
age: 20..60
|
||||
energy: 0.5..1.0
|
||||
}
|
||||
|
||||
enum LocalEnum {
|
||||
option_a,
|
||||
option_b,
|
||||
option_c
|
||||
}
|
||||
Reference in New Issue
Block a user