On this page
Vada syntax reference
Vada is Verada's Ada-style presentation. It uses explicit declarations, package specifications and bodies, begin/end blocks, and named contract aspects. You can use Vada without prior Ada experience: the chapters below define its source forms and connect them to Verada's shared type, execution, and verification rules.
Vada is the syntax of a provable subset of Ada: a valid Ada program is a Vada program when it stays within that subset, and Verada checks, proves and compiles it.
Contents
| Chapter | Use it to answer |
|---|---|
| Lexical structure | How names, literals, comments, keywords and punctuation are written |
| Expressions | How values, calls, indexing, operators, aggregates and quantified expressions are written |
| Declarations and types | How objects, integer types, arrays, records, private/tagged/access types and renamings are declared |
| Units, calls and generics | How projects divide into packages and subprograms, and how reusable generic APIs are spelled |
| Statements | How state changes, branches, loops, blocks, returns and exceptions are written |
| Contracts and ownership | How contracts, ghost code, state models, allocation and cleanup are expressed |
| Tasking, devices and pipelines | How protected state, tasks, external objects and stream operations are written |
Use the shared language reference for semantic rules common to Vada, Varc and Vibe. In particular, integer ranges explains why an addition and a return into a constrained subtype can require different checks. The first proof lesson supplies a complete introductory project.
Read a small Vada unit
A function computes a value; a procedure performs an action and may update out or in out parameters. A package groups declarations. The package specification is the interface other units can see; its body supplies implementations.
package Counters is
function Next (Value : Natural) return Natural
with Pre => Value < Natural'Last,
Post => Next'Result = Value + 1;
end Counters;In that specification, Value : Natural declares an input parameter, return Natural declares the result subtype, Pre is the caller's obligation, and Post is the result guarantee the implementation must prove. Natural'Last means the upper bound of Natural. The apostrophe introduces an attribute; it is not member access.
The body is a separate compilation unit:
package body Counters is
function Next (Value : Natural) return Natural is
begin
return Value + 1;
end Next;
end Counters;These are context examples: name the files counters.vads and counters.vadb and add a main unit before building an executable. The maintained equivalent is Bounded's specification and body.
What is distinctive
- Declarations precede executable statements within a declarative region. Introduce a nested
declareblock for a new region after statements have begun. :=assigns;=compares.;terminates declarations and statements. Newlines do not.- Names ignore case:
Countandcountdenote the same name. Distinct integer types still remain distinct types even when their ranges match. A(I)can be a call, indexing, conversion, or a constrained type indication, depending on the resolved prefix.A(I .. J)is a slice in an expression.- A range
Low .. Highincludes both endpoints.foriteration introduces its own loop parameter; there is no need to predeclare it. and thenandor elseshort-circuit. Plainandandorevaluate both operands.- A package is not a runtime object with arbitrary shared references. Ownership, effects, initialization and proof apply to every accepted program.
Compatibility and exclusions
| Family | Verada treatment |
|---|---|
| Numeric scalars, arrays, records, subtypes, generics, tagged types | Supported under Verada's semantic/proof restrictions |
| Ada library/API names | Only the predefined Verada library and explicitly supplied units are available |
SPARK_Mode |
Compatibility annotation; Off cannot disable Verada's proof policy |
'Unchecked_Access, 'Unrestricted_Access, access discriminants |
Excluded; access all types follow the general access rules |
goto and <<statement labels>> |
Excluded; named loops/blocks remain supported |
Rendezvous task entries, accept, select, abort, requeue, parallel constructs |
Excluded; use supported tasks/protected entries |
| Obsolescent Ada forms and pragma equivalents of aspects | Rejected with modern replacements |
Reclaimed types with Finalizable |
A documented GNAT extension, not plain Ada 2022 |
Lockstep iterator sources and iterator while clauses |
Verada extensions requiring explicit permission in Vada |
APL text (APL ("...")) |
A Verada extension requiring explicit permission |
See Verada and standard Ada for the complete list of differences from Ada, and compatibility for translation between the syntaxes.
How to read syntax patterns
Words in capitals such as Name, Type and Expression are placeholders. Square brackets in prose patterns mean an optional part; { item } means zero or more repetitions unless the pattern explicitly shows a source brace. Do not copy those notation brackets into Vada source. Code fences showing actual Ada fragments use literal [] only for aggregates.
A fragment labeled “inside a body” assumes surrounding declarations supply every name. Complete executable examples are linked separately. A syntax reference does not replace the toolchain instructions for source discovery, main selection, installation or command flags.
Executable syntax sample
The complete syntax-reference project exercises the declarations and expressions used across these chapters: an enumeration, constrained subtype, array and record, a delta update, mutable/named calls, a generic instance, contracts, quantification, a reduction and a range loop.
From the repository root:
veradic prove --no-cache --project docs/manuals/examples/syntax-reference/vada/verada.toml
veradic run --project docs/manuals/examples/syntax-reference/vada/verada.tomlThe run prints:
syntax: 3
sum: 6
Advanced fragments elsewhere have explicit context and links to the maintained language corpora. They should not be copied as complete standalone executables without their declarations, unit structure and required contracts.