Nim Internals and the Future of Nim

49.1 Compiler Architecture

Key compiler modules: ast.nim, parser.nim, sem.nim, semexprs.nim, sigmatch.nim (overload resolution), vm.nim (compile-time interpreter), cgen.nim, injectdestructors.nim, lambdalifting.nim.

system.nim: the implicitly imported core module (procs like echo, len, and the core types).

Lexer → Parser (AST: PNode) → Semantic pass (sem*: types, overload resolution, generics, macros via VM)
      → Transformations (lambda lifting, closure iterators, destructor injection: injectdestructors.nim)
      → Backend codegen (cgen → C/C++, jsgen → JS) → C compiler & linker

49.2 Contributing

The compiler is written in Nim. Bootstrapping: ./build_all.sh / koch boot -d:release.

koch tasks: koch temp (build a debug compiler), koch tests, koch docs.

RFCs at github.com/nim-lang/RFCs. Forum at forum.nim-lang.org. Discord/Matrix/IRC.

49.3 Roadmap: Nim 3 / Nimony

Nimony / Nim 3 (in development by Andreas Rumpf): incremental compilation (IC), a new intermediate format (NIF), stronger guarantees (no implicit nil derefs, refined effect system), simpler semantics, better tooling performance, and a focus on hard real-time and embedded predictability.

The Nim 2.x line continues with stability and IC improvements.

Follow the official blog (nim-lang.org/blog) for current status. Roadmap details change.