The Valk programming language
A fast, simple & safe programming language.
Native performance, a strict type system, and concise syntax. Build for Linux, macOS, and Windows.
curl -sSL https://valk-lang.dev/install.sh | bashuse valk.http
fn handler(req: http.Request) http.Response {
return http.Response.text("Hello world!")
}
fn main() {
let server = http.Server.new("127.0.0.1", 9000, handler)
server.start() ! panic("Failed to start server")
}
$ valk build server.valk --run
$ curl http://127.0.0.1:9000
Hello world!
The language
Simple to write, fast to run.
Native compilation
An embedded LLVM backend turns your code into a native binary, no runtime to install.
Strict types and generics
Nullable values, errors and generic code are checked when you build, not when you run.
Coroutines
Stackful coroutines start small, 4 to 32 KB, and grow when they need more stack.
C compatible
Call C libraries with extern and export functions to C; structs follow each platform’s C ABI.
Package manager
vman installs packages for your project and switches between Valk versions.
Garbage collected
Memory you no longer use is freed for you; there are no manual frees or lifetimes to manage.
Benchmarks
Built for real performance.
Native performance, with simple syntax and a productive development experience.
Valk 0.7.11 · Go 1.27.1 · Rust 1.97.1
Full results and source on GitHub ↗HTTP hello world
Requests per second, higher is better.
Compares Valk HTTP, Rust hyper, and Go fasthttp serving a small “Hello world” response. Measures requests per second under concurrent load, using all CPU cores.
binary-tree
Time in seconds, lower is better.
Builds and traverses binary trees of different depths, mixing temporary trees with one long-lived tree. Tests allocation, pointer access, and memory reclamation.
json-serde
Time in seconds, lower is better.
Decodes a GeoJSON document into typed objects 50,000 times, then serializes the results back to JSON. Tests parsing, object creation, and encoding.
lru
Time in seconds, lower is better.
Exercises a 1,000-entry least recently used cache over 11 million iterations. Measures hash-map access, linked-list updates, and eviction.
Spectral norm
Time in seconds, lower is better.
Approximates a matrix’s spectral norm through repeated matrix–vector products. Uses four workers to test floating-point computation and parallel execution.
Use cases
What you can build with Valk
-
Web servers and APIs
The standard library serves HTTP/1.1 and HTTP/2, with routing, WebSockets, templates and JSON. Packages connect Postgres, MySQL, Redis and SQLite. vpkg.dev, the package registry, is a Valk web server.
HTTP servers in the docs → -
$ vman --help Valk package manager Usage: vman <command> Installs packages for a project, and the valk versions to build it with. Commands: install Install the packages of this project, or add one update Update the packages to the newest versions they allow remove Remove a package from this project versions List the versions of a package, and the valk versions they need init Write a valk.json for this project template Write starting code into this project
Command line tools
Packages parse commands, flags and arguments, and complete them in your shell. vman, Valk’s package manager, is written in Valk and can install a package’s programs for your user.
vman on GitHub ↗ -
use valk.fs use valk.json use valk.regex fn main() { let log = fs.read("access.log") ! return let re = regex.Regex.new("\" (\\d{3}) ") ! return let counts = Map[uint]{} each re.find_all(log) as m { counts[m.get(1) ?? "?"] += 1 !? 0 } println(json.from(counts).encode()) }Data and files
Regex, JSON, compression, cryptography and time zones come with the standard library. Packages add images, CSV and TOML.
Packages on vpkg.dev ↗ -
Games
Valk calls C libraries such as raylib for windows, 2D and 3D drawing, input, audio and shaders. Valkcraft, a block world game, is built this way.
Valkcraft on GitHub ↗
Built in the open.
Explore the source, follow the roadmap, or join the conversation.
