-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
P0Priority 0 - CriticalPriority 0 - CriticalcompilerCompiler systemCompiler systemcoreCore system componentCore system componentirIntermediate RepresentationIntermediate Representation
Milestone
Description
Complete Schema → IR Compilation Pipeline
Priority
P0 (Critical) - Core transformation that enables all downstream features
Labels
corecompilerirP0
Estimated Effort
2-3 weeks
Description
The AST → IR compilation pipeline is partially implemented with many todo!() placeholders. This is the core transformation that converts parsed schemas into the intermediate representation used for versioning, diffing, and code generation.
We need to complete:
- Object stage compilation
- Import resolution
- Semantic validation
- Context management
- Error reporting
Current State
Location: core/src/schema/ir/compiler/
Basic structure exists but incomplete compilation stages. 15+ TODOs in compiler/interpreter code.
TODO References
compiler/mod.rs:25- Source name trackingir/context.rs:36,40,70- Incomplete context methodscompiler/interpreter/object_stage/mod.rs:50,55- Import resolutioncompiler/interpreter/freezing.rs:47,165,183- Freezing logic
Acceptance Criteria
- All AST node types compile to IR (struct, enum, protocol, function, etc.)
- Import statements resolve correctly across files
- Semantic validation catches errors:
- Duplicate names
- Type mismatches
- Invalid references
- Circular dependencies
- Compilation context tracks all symbols correctly
- Rich error messages with source locations using
ariadne - All example schemas in
examples/compile successfully - No TODO items remain in compiler code
Tasks
- Complete object stage compilation for all AST nodes
- Implement import resolution system
- Add semantic validation passes (name resolution, type checking)
- Complete Context implementation for symbol tracking
- Add source location tracking throughout compilation
- Implement proper error accumulation (don't stop at first error)
- Create integration tests for full AST→IR pipeline
- Profile and optimize compilation speed
- Document compiler architecture (phases, passes, data structures)
Technical Notes
The compiler uses a multi-stage approach:
- Parse - AST generation (handled by parser)
- Object Stage - Build intermediate objects
- Freezing - Convert to FrozenUnits for CAS
- Validation - Semantic checks
Dependencies
- Expand Standard Library Schemas #1 Parser must be complete
Blocks
- Build Package Configuration System #6 Code Generation (needs complete IR)
Metadata
Metadata
Assignees
Labels
P0Priority 0 - CriticalPriority 0 - CriticalcompilerCompiler systemCompiler systemcoreCore system componentCore system componentirIntermediate RepresentationIntermediate Representation
Type
Projects
Status
Todo