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
90 lines
1.4 KiB
Plaintext
90 lines
1.4 KiB
Plaintext
// Test override as field values
|
|
|
|
template HumanNeeds {
|
|
sleep: 0.8
|
|
food: 0.7
|
|
social: 0.5
|
|
health: 0.6
|
|
}
|
|
|
|
template BakerSchedule {
|
|
work_start: 6
|
|
work_end: 14
|
|
lunch_time: 12
|
|
}
|
|
|
|
// Override in field value - set operations
|
|
character Alice {
|
|
name: "Alice"
|
|
needs: @HumanNeeds {
|
|
sleep: 0.9
|
|
social: 0.7
|
|
}
|
|
}
|
|
|
|
// Override with remove operation
|
|
character Bob {
|
|
name: "Bob"
|
|
needs: @HumanNeeds {
|
|
remove social
|
|
sleep: 0.6
|
|
}
|
|
}
|
|
|
|
// Override with append operation
|
|
character Carol {
|
|
name: "Carol"
|
|
needs: @HumanNeeds {
|
|
append creativity: 0.8
|
|
food: 0.9
|
|
}
|
|
}
|
|
|
|
// Override with mixed operations
|
|
character David {
|
|
name: "David"
|
|
needs: @HumanNeeds {
|
|
sleep: 0.95
|
|
remove social
|
|
append exercise: 0.7
|
|
}
|
|
}
|
|
|
|
// Multiple overrides in same character
|
|
character Elena {
|
|
name: "Elena"
|
|
needs: @HumanNeeds {
|
|
sleep: 0.7
|
|
food: 0.8
|
|
}
|
|
daily_schedule: @BakerSchedule {
|
|
work_start: 5
|
|
remove lunch_time
|
|
}
|
|
}
|
|
|
|
// Empty override (inherits all)
|
|
character Frank {
|
|
name: "Frank"
|
|
needs: @HumanNeeds {
|
|
}
|
|
}
|
|
|
|
// Only removes
|
|
character Grace {
|
|
name: "Grace"
|
|
needs: @HumanNeeds {
|
|
remove sleep
|
|
remove food
|
|
}
|
|
}
|
|
|
|
// Only appends
|
|
character Henry {
|
|
name: "Henry"
|
|
needs: @HumanNeeds {
|
|
append rest: 0.5
|
|
append work: 0.8
|
|
}
|
|
}
|