Marrow-Lang
A compiled language built from scratch in C, targeting Cortex-VM as its backend. Work in progress.
- lines of C
- 2,114
- source files
- 15
- backend target
- Cortex-VM
Overview
Marrow-Lang is my compiled language project — a from-scratch compiler pipeline written in C, targeting Cortex-VM as the backend. The entire toolchain is hand-rolled: no parser generators, no LLVM, no runtime borrowed from another language. Every component from lexer to code emission is designed and implemented directly.
Building Cortex-VM first was intentional. The VM's flat calling convention, word-addressed memory model, and 64-register file were all designed with Marrow's code generation needs in mind. Now that the backend is stable and well-tested, the compiler frontend is the active work.
Current Status
- Tokenizer — complete; parses source and prints token streams
- Number subsystem — complete; arbitrary-precision decimal digit representation with basic arithmetic
- Parser / AST — in progress; building AST from token stream
- Bytecode emission — next; will emit Cortex-VM assembly via the
cortexAssemblelibrary API - VM execution — pending; Cortex-VM is ready and waiting at v0.5.0, 201 tests passing
Pipeline
- Lexer — tokenises source into a flat token stream
- Parser — hand-rolled recursive-descent, produces an AST; AST nodes allocated through the arena library
- Semantic analysis — type checking and name resolution
- Code generation — walks the AST and emits Cortex-VM assembly, assembled via
cortexAssemble()
Why a Custom Backend?
Targeting LLVM means inheriting its complexity. Targeting x86 directly means writing a platform-specific backend and wrestling with a calling convention I didn't design. Cortex-VM gives me a backend I understand completely — every instruction, every calling convention rule, every binary format detail is something I wrote and can change. That control makes it much easier to experiment with language semantics without getting stuck on backend mysteries.