On this page
Compatibility and translation
Verada shares one semantic core across three syntaxes. Each borrows the spelling of a familiar language without taking on all of that language. This chapter states how Vada relates to Ada, Varc to C-family languages and Vibe to Python, and how translation between the syntaxes works.
Vada and Ada
Vada is Ada's syntax for a provable subset of Ada. Ordinary declarations, statements, types and contracts mean what they mean in Ada, and common programs can be compiled with GNAT as well. Verada adds requirements that Ada does not: ownership of access values, initialization and effect analysis, proof of every check, and termination of functions. A program GNAT accepts may therefore be rejected by Verada, or fail to prove.
Verada and standard Ada lists the Ada features Verada leaves out with their replacements, the forms whose meaning differs from Ada's (the 64-bit Integer, text, exceptions, ownership, representation), and Verada's extensions.
Some Vada forms are Verada or GNAT extensions rather than standard Ada:
| Form | Status |
|---|---|
Finalizable reclaimed types |
GNAT extension; GNAT needs -gnatX |
Iterator while clauses and lockstep sources |
Verada extension, enabled by pragma Extensions_Allowed (On) |
'Scan and APL text |
Verada extension, enabled by pragma Extensions_Allowed (On) |
Contracts and proof compared with SPARK
Verada's contracts and flow analysis follow SPARK's: Pre, Post, Global, Depends, abstract state, ghost code, loop invariants and variants, Exceptional_Cases and the ownership rules have the same meaning. Verada has its own front end, proof encoding and solvers, so a program that GNATprove proves need not prove with Verada, and the reverse. A Verada proof is not a GNATprove result. SPARK_Mode => Off does not switch analysis off (B8004): Verada checks the whole program.
Varc and C-family languages
Varc provides braces, fn, let/var, pub, familiar calls, and explicit writable actual marks. Its type identity, parameter modes, ranges, contracts, ownership and proof are Verada's. It has neither C's integer promotions nor Rust's borrow syntax.
& at a call marks an out or inout argument; it does not create a stored pointer. :: selects attributes and type properties. Varc includes the upper bound with a...b or a..=b and excludes it with a..<b; a bare a..b is rejected (B0105). Calls use parentheses and indexing brackets, mixed operator groups need parentheses, and lambdas are written only as pipeline stages. See the Varc reference.
Vibe and Python
Vibe uses Python's modules, annotations, statements and classes, with static types. int is the 64-bit Integer, float is Long_Float, str is the copyable Text type, and typed containers are instances of Verada's library generics. / is true division and // floor division, as in Python. There is no dynamic typing and no import of arbitrary Python packages. The Vibe compatibility chapter lists the Python forms Vibe accepts and those it excludes.
veradic stubs writes .pyi files for Python type checkers. A type checker's approval is not a Verada proof (see Python execution).
Mixed projects
Units in different syntaxes call each other through ordinary interfaces: modes, contracts and concrete types. Type identity comes from the declaring unit or instance, not from similar spelling or matching fields. When one syntax cannot declare a construct (Vibe has no fixed-point or callback-type declarations, for example), declare it in a Vada or Varc unit and use it from the others. A project builds from complete units, package bodies included.
Translation
veradic translate --to vada|varc|vibe rewrites units into another syntax: it splits or merges package specifications and bodies, maps names, writes implicit generic instances as named instances and keeps comments. A translated project is meant to check, prove and run as the original does; check and run it before relying on it.
--plain-ada with --to vada writes Verada's iterator extensions as plain Ada loops, for GNAT. An extension can be written this way when its pipeline is the whole value of a return, an assignment or an expression function, or a loop.
Foreign representation
The C interface has explicit rules for scalars, arrays, objects and callbacks, described in the Toolchain Manual. Imported subprograms need accurate contracts and effects, which proof trusts. A record without a representation clause has Verada's natural layout (components in order, each at its alignment, as a C compiler would place them); one with a clause has the clause's, so a C structure can be described exactly with a record representation clause.