Skip to content
metif12Public

About

A comprehensive book for the V programming language

Resources

Contributing

Stars

2 stars

Watchers

0 watching

Forks

Repository files navigation

The V Programming Language Book

A comprehensive book for the V programming language, inspired by The Rust Book.

Project Goals

  • Comprehensive: Cover V from installation to advanced topics
  • Tested: Every code example compiled and run in CI
  • Accessible: Available in 16 languages including Farsi (fa), Arabic (ar), and Urdu (ur)
  • Community-driven: Open to contributions from the V community
  • Modern: Targets V 0.5.2+

Current Status

Component Status
Project structure Complete
Static site generator Complete — V + veb, no mdBook
Search Complete — in-browser full text, Ctrl+K
CI pipeline Complete
Code tester Complete
Book structure validator Complete
Chapters 0-22 Written
Appendices A-H Written
Code examples 171/171 passing
Translations (15 languages) Complete

The Site

The book is a static site generated by V itself:

v run site                  # build the whole site into dist/
v run site serve            # build, then preview at http://localhost:8090/v-book/

dist/ holds the whole book — English at the root, every translation under its own language directory — plus sitemap.xml, robots.txt, a per-language search index, and a 404.html. It deploys to GitHub Pages as-is, no server required.

What the site does:

  • Search — Ctrl/Cmd+K focuses the search box, / does the same, and the results come from a full text index that ships with the page, so nothing leaves the browser and any static host works.
  • The tour's layout — V logo, dark navy bar, table of contents on the left, and one centred reading column. Light and dark themes, both resolved from the system until the reader says otherwise.
  • Code blocks — V blocks are highlighted by CodeMirror with a copy button; shell blocks show the commands.
  • Right-to-left — the Arabic, Persian and Urdu translations switch the whole shell, and each language keeps the reader on the same page.
  • Offline — a service worker caches the shell and the pages a reader has opened, so the book is readable on a train, and the site installs from the web app manifest. The icons are generated by v run tools/make_icons.vsh, which draws the V mark into a PNG at the sizes a manifest asks for.

Quick Start

Prerequisites

  • V — 0.5.2 or newer. The generator uses the current $tmpl('file.html', data) API and veb's static compression, both of which landed after the 0.5.2 release binary, so the CI workflows build V from source. Locally, v up gets you there:
v up

Build the book

v run site

Preview

v run site serve

Test code examples

v run tools/code_check.vsh        # src/ and every translation
v run tools/code_check.vsh src    # the English source only

Validate book structure

v run tools/validate.vsh

Run tests

v test .

Project Structure

v-book/
├── src/                    # Markdown source (English, canonical)
│   ├── SUMMARY.md
│   ├── ch00-introduction.md
│   ├── ch01-getting-started.md
│   ├── ...
│   ├── ch22-performance-and-benchmarking.md
│   └── appendix-h-exercises.md
├── listings/               # V code examples
│   ├── ch01-hello-world/
│   ├── ch01-hello-v/
│   └── ...
├── static/                 # assets the generator copies into dist/
│   ├── app.css             # chrome: top bar, search, TOC, theme
│   ├── book.css            # prose typography
│   ├── app.js              # theme, search, panels, code blocks
│   ├── logo.svg            # V logo
│   └── codemirror/         # syntax highlighting
├── site/                   # the generator itself (pure V + veb)
│   ├── main.v              # build, preview, sitemap, 404
│   ├── markdown.v          # Markdown renderer
│   ├── search.v            # full text index
│   └── site.v              # page shell, navigation, locales
├── tools/
│   ├── code_check.vsh       # compiles and runs every code block
│   └── validate.vsh        # book structure validator
├── translations/           # 16 language translations
│   ├── README.md
│   ├── de/                 # German
│   ├── es/                 # Spanish
│   ├── fr/                 # French
│   ├── zh/                 # Chinese
│   ├── ru/                 # Russian
│   ├── ja/                 # Japanese
│   ├── ko/                 # Korean
│   ├── pt/                 # Portuguese
│   ├── it/                 # Italian
│   ├── ar/                 # Arabic (RTL)
│   ├── fa/                 # Persian/Farsi (RTL)
│   ├── hi/                 # Hindi
│   ├── bn/                 # Bengali
│   ├── ur/                 # Urdu (RTL)
│   ├── id/                 # Indonesian
│   └── tr/                 # Turkish
├── scripts/                # scaffolding scripts
│   ├── new_chapter.vsh
│   └── new_locale.vsh
├── .github/workflows/
│   ├── main.yml            # code tests, site build, validation
│   └── pages.yml           # GitHub Pages deploy
├── v.mod                   # V module
├── AGENTS.md                # AI assistant instructions
├── CONTRIBUTING.md         # contribution guidelines
└── README.md

Chapters

The path

  • The V Roadmap: a stage-by-stage route through the book, with the tracks (CLI, web, systems, graphics, scripts, metaprogramming) and the projects to build in order

Part I: Getting Started

  • Chapter 0: Introduction
  • Chapter 1: Getting Started (Installation, Hello World, Hello V)
  • Chapter 2: Building a Project (v.mod, v fmt, v test)

Part II: Common Programming Concepts

  • Chapter 3: Common Concepts (variables, types, functions, control flow)
  • Chapter 4: Ownership and Memory (stack/heap, GC, autofree, references)
  • Chapter 5: Structs (definition, methods, embedding, access modifiers)
  • Chapter 6: Enums and Sum Types (enums, sum types, pattern matching)
  • Chapter 7: Modules and Packages (module system, visibility, VPM)
  • Chapter 8: Collections (arrays, maps, strings)
  • Chapter 9: Error Handling (Option, Result, custom errors)

Part III: Intermediate V

  • Chapter 10: Generics
  • Chapter 11: Testing
  • Chapter 12: I/O Project (CLI tool capstone)
  • Chapter 13: Functional Features (closures, higher-order functions)
  • Chapter 14: Concurrency (goroutines, channels, shared state)
  • Chapter 15: Veb Web Framework
  • Chapter 16: C Interop
  • Chapter 17: Advanced Features (attributes, comptime, operator overloading)
  • Chapter 18: Memory Management Deep Dive
  • Chapter 19: Tooling
  • Chapter 20: Final Project (web application capstone)
  • Chapter 21: Cross-Compilation and Deployment
  • Chapter 22: Performance and Benchmarking

Appendices

  • Appendix A: Keywords
  • Appendix B: Operators
  • Appendix C: V Syntax Reference
  • Appendix D: Standard Library Overview
  • Appendix E: V and C Interop Reference
  • Appendix F: Translations
  • Appendix G: How V is Made
  • Appendix H: Exercises

Translations

This book is available in 16 languages:

Code Language Status
en English Complete (canonical)
de Deutsch Complete
es Español Complete
fr Français Complete
zh 简体中文 Complete
ru Русский Complete
ja 日本語 Complete
ko 한국어 Complete
pt Português Complete
it Italiano Complete
ar العربية Complete (RTL)
fa فارسی Complete (RTL)
hi हिन्दी Complete
bn বাংলা Complete
ur اردو Complete (RTL)
id Bahasa Indonesia Complete
tr Türkçe Complete

The three newest chapters ship in English until a translation arrives, and the language menu keeps the reader on the page they asked for wherever that page exists.

See translations/README.md for how to contribute.

Code Examples

Code examples follow these conventions:

  • v — compiled and run in CI
  • v ignore — not compiled (pseudocode, incomplete examples)
  • v no_run — compiled but not run (blocking examples)

Every code block is self-contained and tested in CI. tools/code_check.vsh extracts all v blocks and runs each one through v run.

Contributing

See CONTRIBUTING.md.

License

MIT

About

A comprehensive book for the V programming language

Resources

Contributing

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages