Problem
The Bishop compiler is well-organized into phases (lexer, parser, typechecker, codegen), but there's no high-level documentation explaining:
- How the phases interact
- Data flow between phases (what each phase produces/consumes)
- The role of mutable AST fields
- How module imports work through the pipeline
- The stdlib generation architecture
New contributors must read through multiple source files to understand the architecture.
Suggested Content
docs/ARCHITECTURE.md
# Bishop Compiler Architecture
## Compilation Phases
1. **Lexer** (src/lexer/)
- Input: Source text
- Output: Token stream
- Handles: Keywords, literals, operators, comments
2. **Parser** (src/parser/)
- Input: Token stream
- Output: AST (untyped)
- Handles: Syntax validation, AST construction
3. **Type Checker** (src/typechecker/)
- Input: AST (untyped)
- Output: AST (annotated with types via mutable fields)
- Handles: Type inference, semantic validation
4. **Code Generator** (src/codegen/)
- Input: Typed AST
- Output: C++ source code
- Handles: C++ emission, stdlib integration
## Data Flow Diagram
[ASCII art or Mermaid diagram]
## Key Abstractions
- ASTNode hierarchy
- TypeInfo struct
- Module system
...
Suggested Additional Docs
- CONTRIBUTING.md - How to add new language features
- docs/stdlib.md - How stdlib modules work
- docs/error-handling.md - Bishop's error model (fail/or)
Priority
High - This significantly reduces onboarding time for contributors.
Problem
The Bishop compiler is well-organized into phases (lexer, parser, typechecker, codegen), but there's no high-level documentation explaining:
New contributors must read through multiple source files to understand the architecture.
Suggested Content
docs/ARCHITECTURE.md
Suggested Additional Docs
Priority
High - This significantly reduces onboarding time for contributors.