aallan/vera
Vera: a programming language designed for LLMs to write
What it solves
Models struggle with maintaining coherence over scale, reasoning about state, and managing variable names, which often leads to naming-related errors and a loss of track of values. Vera is a programming language specifically designed for large language models to write, replacing traditional variable names with structural references and making contracts mandatory to ensure code is mechanically checkable.
How it works
Vera replaces variable names with typed slot references (e.g., @Int.0 for the most recent integer binding). It uses an SMT solver (Z3) to statically prove preconditions (requires) and postconditions (ensures) at every call site. The language is pure by default, requiring explicit declaration of effects (like <Http> or <Inference>) in function signatures. Programs compile to WebAssembly, allowing them to run on the command line, in the browser, or as WASI Preview 2 components.
Who it’s for
AI agents and LLMs acting as primary authors of code, as well as developers who want to formally verified, secure code that is easy for models to generate without naming conflicts.
Highlights
- Typed Slot References: Eliminates naming errors by using structural references instead of variable names.
- Mandatory Contracts: Every function must declare preconditions and postconditions that the compiler proves statically via Z3.
- Explicit Effect Typing: Side effects are explicitly typed in the signature, preventing unauthorized operations.
- Agent-Optimized Diagnostics: Compiler errors are written as instructions for models, providing rationales and concrete fix examples.
- Secure by Design: Prevents common vulnerabilities like SQL injection by enforcing rules on where strings originate at the type-checker level.
- Multi-target Compilation: Compiles to WebAssembly for execution across CLI, browser, and WASI 0.2 hosts.
Related
- Project
- Project
- Project
- Project
- Project