Introduction
V is a statically typed compiled programming language designed for building maintainable, readable, and fast software. It compiles directly to C, producing small binaries with no runtime dependencies, and offers compilation speeds measured in milliseconds even for large projects.
What V Does
- Compiles entire projects in under a second with zero external dependencies in output
- Translates V source to human-readable C, enabling deployment anywhere C runs
- Provides memory safety through autofree and optional garbage collection modes
- Includes a built-in package manager, formatter, testing framework, and build system
- Supports cross-compilation to major platforms including WASM from a single codebase
Architecture Overview
V parses source files into an AST, performs semantic analysis with type checking, then generates C code that is compiled by a system C compiler. The autofree memory model inserts deallocation calls at compile time by tracking variable lifetimes, avoiding both manual memory management and GC pauses. For graphics-heavy applications, V includes bindings to OpenGL and Sokol, and ships a native UI library built on platform widgets.
Self-Hosting & Configuration
- Clone the repo and run
maketo bootstrap; the compiler builds itself in about 0.5 seconds - Use
v installto fetch packages from the VPM package registry - Configure build options via
v.modmanifest files in project roots - Set output mode with flags:
-prodfor optimized release builds,-gc boehmfor GC mode - Cross-compile with
-os windowsor-os linuxflags from any host platform
Key Features
- Sub-second full project compilation eliminates waiting in edit-compile-run cycles
- Minimal syntax with no null, no undefined behavior, no globals by default
- Built-in concurrency with coroutines and channels inspired by Go
- Hot code reloading for rapid iteration during development
- Interop with C libraries by directly importing C header files
Comparison with Similar Tools
- Go — similar simplicity philosophy but V produces smaller binaries and compiles faster; Go has a larger ecosystem
- Zig — both target C replacement; Zig offers more low-level control while V prioritizes simplicity
- Rust — stronger memory safety guarantees via borrow checker; V trades some safety for faster compilation and easier learning
- Nim — both compile to C; Nim has a more mature standard library while V has simpler syntax
- C — V generates C as output; V adds memory safety, modules, and modern tooling on top
FAQ
Q: Is V production-ready? A: V is usable for personal and mid-size projects. The language is pre-1.0, so breaking changes may occur, but the core compiler and standard library are stable for many use cases.
Q: How does the autofree memory model work? A: The compiler performs escape analysis and inserts free calls at scope exits. For cases autofree cannot handle, you can opt into the Boehm GC or manual management.
Q: Can V interoperate with existing C libraries? A: Yes. V can call C functions directly and import C header files, making it straightforward to wrap existing C libraries.
Q: What platforms does V support? A: V supports Linux, macOS, Windows, FreeBSD, and can cross-compile to WebAssembly and Android from any host.