Skip to content

Compiler Pipeline

Source goes through a multi-stage pipeline. Each stage can be inspected independently with the CLI.

Stages

SourceLexerParserASTSemaTyped IRIR OptimizeLLVM IRObjectBinary
StageCLI flagSource dir
Lexersrc/lex/
Parser + ASTsrc/parse/
Semantic analysischecksrc/sema/
Typed IR loweringirsrc/ir/
Typed IR optimizationirsrc/ir/
LLVM IRllvm-irsrc/backend/
Object fileobjvia clang
Binarybuildvia clang

Directory layout

text
include/cnegative/   — public compiler headers
src/support/         — memory, source, diagnostics
src/lex/             — token and lexer logic
src/parse/           — AST and parser
src/sema/            — semantic checking
src/ir/              — typed IR lowering and optimization
src/backend/         — LLVM text backend and toolchain glue
src/cli/             — command entry point
src/asm/             — profiled hot-path assembly
cmake/               — build and test scripts
.github/workflows/   — CI workflows

Current compiler behavior

  • parser recovery keeps reporting after common syntax mistakes
  • typed IR runs before LLVM and now folds simple constant expressions
  • object and binary emission still use the host clang driver

cnegative docs track the current v0.5.2 compiler surface.