Prometheus Compiler
A minimal C++23 language experiment with token-based ELF64 assembly generation for an emit statement and a separate recursive-descent parser and AST prototype.
Educational systems project · experimental compiler
Problem
A small language implementation makes the translation pipeline explicit and inspectable.
Design principle
Implementing a deliberately small language makes each translation boundary inspectable.
- Implementation language
- C++23
- Implemented statement form
- emit
- Assembly/link target in the driver
- ELF64
How it works
Read and tokenize source
The compiler driver reads a source file and invokes its tokenizer.
Explore parsing separately
The parser header defines expression and emit nodes and validates the small grammar; the current executable does not call this parser.
Emit assembly
The current token-to-assembly routine validates an emit integer statement and generates x86-64 Linux exit-system-call instructions.
Assemble and link
The driver writes out.asm, invokes NASM with ELF64 output and links with ld, propagating tool failure.
Engineering decisions
- Keep the grammar small
- An integer-literal emit statement provides a narrow, inspectable first translation target.
- Distinguish parser work from executable behavior
- AST structures and a parser exist, but the driver currently emits from tokens instead of traversing an AST.
- Use external native tools
- NASM and ld perform assembly and linking; they are required by the current executable rather than implemented in the compiler.
Verification and evidence
The reviewed main.cpp and parser.hpp establish the actual driver and separate parser behavior. The README describes the intended larger compiler architecture; the source does not establish an integrated semantic-symbol-analysis stage or general AST code generation.
Scope and limitations
This is an educational experimental compiler, not a general-purpose language implementation. The current driver targets ELF64 and depends on NASM and ld. The AST parser is not wired into executable code generation; wider language support and semantic analysis are not established.