ilusm.dev
Internals

Compiler pipeline

A standard compilers course lists: language speclexerparserASTinterpret or compile. ilusm follows those phases; it does not require Flex, Bison, or LLVM.

Phase map (source of truth: lib/)

Classic step ilusm
1. Language spec Language spec on this site; prose in docs/ in the repo; executable semantics also expressed by the self-hosted frontend and runtime under lib/.
2. Lexer Hand-written Ilusm lexer: canonical lib/frontend/lex.ilu (entry lexer.ilu delegates here). Supporting pieces include lex_kw.ilu, lex_scan.ilu, lex_emit.ilu, lex_state.ilu, lex_chr.ilu, lex_diag.ilu.
3. Parser Recursive-descent (not yacc): lib/frontend/prs.ilu. Public entry points live in parser.ilu (parseprs_run / prs_src).
4. AST / IR Parse trees are explicit objects: prs.ilu documents that every node has a type tag .t. The bytecode layer is described separately from the surface AST in lib/backend/ilu_isa.ilu (ILU instruction families, distinct from tree-walk and from surface syntax).
5a. Interpret (tree walk) lib/runtime/evl.ilu - evaluator over AST. Mode selection and wiring: lib/runtime/hybrid_rt.ilu, lib/runtime/pipeline.ilu.
5b. Compile + VM lib/backend/compiler.ilu - AST → bytecode stream. Opcode table and encoding: mcde.ilu. VM step loop: ilusm_vm.ilu. Human-facing ISA notes: Bytecode ISA on this site.

Stage‑0 seed (ilusm-min)

You run a prebuilt native seed (e.g. stage0/linux-x86_64/ilusm-min), resolved by stage0/resolve_seed.sh. It is enough to execute compile (rebuild ilusm.ilbc via Ilusm sources) and run user .ilu files. It is not a line‑for‑line copy of lex.ilu / prs.ilu / ilusm_vm.ilu. Verification: Engineering & tests and Test results.

For how that fits self-hosting (full stack in lib/, conforming host, self-compile), read Self-hosting & bootstrap.

For how a full host is expected to bridge to the OS, see Host contract and Syscall ABI.

Why not Flex / Yacc / LLVM?

Those are mature generators and backends. ilusm instead keeps the frontend and compiler in Ilusm source for self-hosting and a short path from spec to behavior. The phases are the same ones you learned in 2007–2008; only the tooling and the chosen backend (stack bytecode + in-tree VM) differ.