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
77 lines
1.2 KiB
Plaintext
77 lines
1.2 KiB
Plaintext
// Test name resolution and duplicate detection
|
|
|
|
// These are all unique names - should register successfully
|
|
character Alice {
|
|
age: 30
|
|
name: "Alice Smith"
|
|
}
|
|
|
|
character Bob {
|
|
age: 35
|
|
name: "Bob Jones"
|
|
}
|
|
|
|
template PersonTemplate {
|
|
age: 18..80
|
|
health: 0.0..1.0
|
|
}
|
|
|
|
enum Status {
|
|
active,
|
|
inactive,
|
|
pending
|
|
}
|
|
|
|
life_arc AgeProgression {
|
|
state young {
|
|
on age > 18 -> adult
|
|
}
|
|
state adult {
|
|
on age > 65 -> senior
|
|
}
|
|
state senior {}
|
|
}
|
|
|
|
schedule DailyRoutine {
|
|
06:00 -> 08:00: wake_up
|
|
08:00 -> 17:00: work
|
|
17:00 -> 22:00: evening
|
|
22:00 -> 06:00: sleep
|
|
}
|
|
|
|
behavior SimpleBehavior {
|
|
walk_around
|
|
}
|
|
|
|
institution Library {
|
|
name: "City Library"
|
|
capacity: 100
|
|
}
|
|
|
|
relationship Friendship {
|
|
Alice
|
|
Bob
|
|
bond: 0.8
|
|
}
|
|
|
|
location Park {
|
|
name: "Central Park"
|
|
}
|
|
|
|
species Human {
|
|
lifespan: 80
|
|
}
|
|
|
|
// All names above are unique and should be registered in the name table
|
|
// The name table can be queried by kind:
|
|
// - Characters: Alice, Bob
|
|
// - Templates: PersonTemplate
|
|
// - Enums: Status
|
|
// - LifeArcs: AgeProgression
|
|
// - Schedules: DailyRoutine
|
|
// - Behaviors: SimpleBehavior
|
|
// - Institutions: Library
|
|
// - Relationships: Friendship
|
|
// - Locations: Park
|
|
// - Species: Human
|