Hexen follows a clean, modular architecture that separates concerns and enables systematic development. The implementation reflects our design principles through clear component boundaries and well-defined interfaces.
Source Code (.hxn) ← Hexen source files with .hxn extension
↓
📝 Parser ← Syntax analysis, AST generation
↓
🧠 Semantic Analyzer ← Type checking, symbol resolution, scope management
↓
⚙️ Code Generator ← LLVM IR emission (future)
↓
🎯 Executable
hexen/
├── src/hexen/ # Core compiler implementation
├── tests/ # Comprehensive test suite
└── docs/ # Design documentation & specifications
- Phase I: Language Foundation 🚧 In Progress - Parser and semantic analyzer with core feature set
- Active Development - Implementing and refining language features
- Comprehensive Documentation - Specification documents guide implementation decisions
- LLVM Ready - Architecture designed for future LLVM backend integration
Hexen's development follows a pragmatic, evolution-driven approach that prioritizes rapid iteration while building toward long-term goals:
The initial compiler is implemented in Python, enabling rapid prototyping and experimentation with syntax and semantics. Python's expressiveness lets us focus on language design rather than implementation complexity, accelerating the iteration cycle during Hexen's formative phase.
We leverage LLVM as our code generation backend through llvmlite - a lightweight Python binding designed specifically for JIT compilers. This approach provides:
- Pure Python IR construction for maximum flexibility during development
- Production-grade optimization through LLVM's mature toolchain
- Target independence across multiple architectures from day one
The architecture supports natural evolution from prototype to production:
- Phase I: Language Foundation 🚧 In Progress - Parser, semantic analyzer, unified block system, comptime types
- Phase II: Code Generation 📋 Planned - LLVM IR emission and executable generation
- Phase III: Self-Hosting 📋 Planned - Hexen compiler written in Hexen, proving the language's capabilities
- Phase IV: Complete Toolchain 📋 Planned - Entire development environment implemented in Hexen
This progression embodies our core principle: build tools that work exceptionally well, then use those tools to build even better tools.