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:
68
tests/examples/bidirectional_relationships.sb
Normal file
68
tests/examples/bidirectional_relationships.sb
Normal file
@@ -0,0 +1,68 @@
|
||||
// Test bidirectional relationship resolution
|
||||
// Relationships can be declared from either participant's perspective
|
||||
|
||||
// Simple relationship with no self/other blocks
|
||||
relationship Friendship {
|
||||
Alice
|
||||
Bob
|
||||
bond: 0.8
|
||||
years_known: 5
|
||||
}
|
||||
|
||||
// Relationship with roles
|
||||
relationship Marriage {
|
||||
Martha as spouse
|
||||
David as spouse
|
||||
bond: 0.9
|
||||
anniversary: "2015-06-20"
|
||||
}
|
||||
|
||||
// Relationship with self/other blocks from one perspective
|
||||
relationship ParentChild {
|
||||
Martha as parent self {
|
||||
responsibility: 1.0
|
||||
protective: 0.9
|
||||
} other {
|
||||
dependent: 0.8
|
||||
}
|
||||
Tommy as child
|
||||
}
|
||||
|
||||
// Asymmetric relationship - different roles
|
||||
relationship EmployerEmployee {
|
||||
Martha as employer self {
|
||||
authority: 0.9
|
||||
} other {
|
||||
respect: 0.8
|
||||
}
|
||||
Elena as employee
|
||||
}
|
||||
|
||||
// Complex relationship with shared and participant-specific fields
|
||||
relationship RomanticPartnership {
|
||||
Alice as partner self {
|
||||
love: 0.95
|
||||
trust: 0.9
|
||||
} other {
|
||||
attraction: 0.85
|
||||
respect: 0.95
|
||||
}
|
||||
Charlie as partner
|
||||
|
||||
// Shared fields
|
||||
commitment: 0.85
|
||||
compatibility: 0.9
|
||||
}
|
||||
|
||||
// Multiple relationships between same people with different names
|
||||
relationship Friendship2 {
|
||||
Alice
|
||||
Charlie
|
||||
bond: 0.7
|
||||
}
|
||||
|
||||
relationship Coworkers {
|
||||
Alice
|
||||
Charlie
|
||||
workplace: "TechCorp"
|
||||
}
|
||||
Reference in New Issue
Block a user