V Compiler Internals and Contributing

46.1 Compiler Pipeline

The compiler lives in vlib/v/: scanner, token, parser, ast, checker, gen/c, gen/js, gen/native, gen/wasm, builder, pref, fmt, doc, vet.

cmd/v is the driver. cmd/tools holds vfmt, vdoc, vpm, vtest, vrepl, vwatch, etc.

The compiler as a library: use v.parser/v.ast/v.checker to build linters, code generators, and analyzers.

.v files → Scanner (v.scanner) → Parser (v.parser → v.ast) → Checker (v.checker: types, generics, smart casts)
         → Transformer / Markused (v.transformer, v.markused) → Code generation (v.gen.c / js / wasm / native)
         → C compiler (tcc/gcc/clang/msvc) → executable

46.2 Building and Contributing

Contribution flow: GitHub issues and PRs at vlang/v, discussions, Discord. Read CONTRIBUTING.md.

Use v doctor output in bug reports. Minimal reproductions are welcome.

v self                      # rebuild the compiler from source
v -keepc -o v2 cmd/v        # build a test compiler
./v2 test-self              # run the compiler test suite
v test vlib/v/tests
v check-md doc/docs.md      # validate code in docs