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
56 lines
2.1 KiB
Markdown
56 lines
2.1 KiB
Markdown
# Compiler Error Examples
|
|
|
|
This directory contains example `.sb` files that demonstrate each type of error
|
|
the Storybook compiler can detect. Each file is intentionally incorrect to showcase
|
|
the error messages and helpful hints.
|
|
|
|
## How to Run
|
|
|
|
To see all error messages, validate each file individually:
|
|
|
|
```bash
|
|
# From the storybook root directory
|
|
cargo build --release
|
|
|
|
# Run each file to see its error
|
|
./target/release/sb validate tests/compiler_errors/01_unexpected_token.sb
|
|
./target/release/sb validate tests/compiler_errors/02_unexpected_eof.sb
|
|
./target/release/sb validate tests/compiler_errors/03_invalid_token.sb
|
|
# ... etc
|
|
```
|
|
|
|
Or use this script to show all errors:
|
|
|
|
```bash
|
|
#!/bin/bash
|
|
for file in tests/compiler_errors/*.sb; do
|
|
echo "═══════════════════════════════════════════════════════════"
|
|
echo "File: $(basename $file)"
|
|
echo "═══════════════════════════════════════════════════════════"
|
|
cargo run --bin sb -- validate "$file" 2>&1 || true
|
|
echo ""
|
|
done
|
|
```
|
|
|
|
## Error Categories
|
|
|
|
### Parse Errors (Syntax)
|
|
- `01_unexpected_token.sb` - Missing colon after field name
|
|
- `02_unexpected_eof.sb` - Incomplete declaration
|
|
- `03_invalid_token.sb` - Invalid character in syntax
|
|
- `04_unclosed_prose.sb` - Prose block missing closing `---`
|
|
|
|
### Validation Errors (Semantics)
|
|
- `05_trait_out_of_range.sb` - Trait value outside 0.0-1.0 range
|
|
- `06_age_out_of_range.sb` - Age value outside 0-150 range
|
|
- `07_unknown_life_arc_state.sb` - Transition to undefined state
|
|
- `08_schedule_overlap.sb` - Schedule blocks overlap in time
|
|
- `09_unknown_behavior_action.sb` - Undefined behavior tree action
|
|
- `10_duplicate_field.sb` - Same field name used twice
|
|
- `11_relationship_bond_out_of_range.sb` - Bond value outside 0.0-1.0 range
|
|
|
|
Each error includes:
|
|
- ✓ Clear error message explaining what went wrong
|
|
- ✓ Helpful hint on how to fix it
|
|
- ✓ Context-specific suggestions
|