Compiler Pipeline

Phase 1 — Bootstrap Compiler (Rust → C)

Source (.nyx) → Lexer → Parser → AST → Type Checker → Region Analysis → C Codegen → GCC → Native Binary
PhaseOutputStatus
LexerToken stream (identifiers, strings, chars, byte literals, numeric suffixes)✅ Complete
Parser (Pratt)AST (structs, enums, generics, closures, match, for, while, slices, type aliases, byte literals)✅ Complete
Type CheckerTyped AST (generic inference, method dispatch, pattern coverage, type casts)✅ Complete
Region AnalysisSimplified escape detection + arena allocation⚠️ Basic
C CodegenC source files with runtime linkage✅ Complete

Parser Features (v0.11.0)

Module System

Status: ✅ Full import pipeline + peer resolution + perf + caching (v0.6.2)

Import resolution, parsing, type-checking, C codegen, forward declarations, and multi-file GCC linking all work. import std.* uses parse-level symbol extraction (stdlib backed by C runtime). import mymod fully compiles and links with auto-injected forward declarations. Peer-module resolution (import token.* from nyxc/lexer.nyx) discovers siblings via parent-directory search path push. Typecheck skipped for large dependency trees (O(n²) perf deferred to self-hosted compiler). Module caching (v0.6.2): source hashes stored in .nyx_cache/ — recompiles skip unchanged modules, GCC linking cached when .exe is newer than all .c files.

Stdlib Status

std/crypto.nyx — compiles successfully through full pipeline (parse → typecheck → codegen).
std/fs.nyx — compiles successfully through full pipeline. Uses local basename() helper and inline getenv() extern (bootstrap compiler doesn't support std.module qualified paths at expression level).

Phase 2 — Self-Hosted Compiler (Nyx → MLIR/LLVM)

Source (.nyx) → Lexer → Parser → AST → Type Checker → Region Inference → MLIR Dialects → LLVM IR → Native/WASM
PhaseOutputStatus
Lexer (Nyx)Token stream⚠️ Partial
Parser (Nyx)AST⚠️ Partial
Type CheckerTyped AST (TIR) — Bidirectional + Hindley-Milner❌ Stub
Region InferenceOwnership-annotated IR — full lifetime analysis❌ Stub
MLIR LoweringMLIR dialects (nyx.async, nyx.region, nyx.struct)❌ Stub
LLVM CodegenLLVM IR → .o / .wasm — LLVM 18+ with LTO❌ Stub