Repository navigation
Roadmap to Self Hosting
Self-hosting means writing the L++ compiler in L++.
L++ already has many compiler-writing ingredients:
- functions
- structs
- enums
- match
- imports
- lists and maps
- strings and files
- generics phase 1
- error propagation
- native compilation
The remaining important gaps are below.
Needed for:
List[Token]
Map[Str, Type]
Result[AstNode]
Current generics are phase 1 with type erasure. Self-hosting needs more precise generic substitution, better payload handling, and likely monomorphization or a stable erased representation with runtime tags.
Needed for reusable compiler abstractions:
Display
Iterator
Visitor
ParserBackend
CodegenTarget
A lexer wants to process text one character at a time. L++ currently has string indexing and char_at, ord, chr, but a dedicated Char type and efficient string iteration would make lexer code cleaner.
Current Result examples use integer error codes. A compiler needs structured errors:
message
file
line
column
error kind
Useful for token buffers, bytecode buffers, and linker data structures.
Self-hosting requires stable modules for:
- string builder
- file paths
- JSON/TOML parsing
- command-line parsing
- hash maps with string keys
- testing helpers
- Fix type alias substitution fully.
- Strengthen generics.
- Add traits/interfaces.
- Add Char and string iterator support.
- Add structured compiler errors.
- Start a small self-hosted lexer in L++.
- Expand to parser, AST, type checker, MIR.