DEVELOPMENT EDITION · 769442725406
Toolchain Manual
On this page

Translation workflow and compatibility

Translation shares a language model, but not every representation has a working equivalent in every output syntax. Treat generated files as candidate source: check, prove and compare execution before replacing a maintained application. See translate for exact arguments and filesystem effects.

A reviewable conversion

Use an empty output directory, give all relevant units, and keep originals outside that directory. For Vada to Varc:

veradic translate --to varc -o converted src/*.vads src/*.vadb
veradic check converted/main.va
veradic prove converted/main.va
veradic run converted/main.va

Adapt filenames/globs to real matching inputs. Resolving dependencies for call-mode marks is best when the required source directories are available beside the supplied files; translate has no --project option. Review imports, public/private extraction, implicit generic instances, mutation markers, parameter/results, comments and names as well as output text.

A Vada spec and body merge into one Varc package or Vibe module; translation to Vada splits public declarations and implementation into a spec and a body. Case and naming rules are not cosmetic. Translation uses what the check learns about names and modes, so give it a program that checks.

Every direction

Each of the six directions between Vada, Varc and Vibe produces a program that checks, proves and runs as the original does: the first-proof application, translated from any of its three versions into either other syntax, prints answer: 42. Vibe output keeps the original's names (a Vada Increment stays Increment), so a translated module reads less like hand-written Python than the maintained Vibe example. Larger programs with generics, views, callbacks, exceptions or tasks deserve the same check-prove-run comparison before the translation replaces the original.

Vibe is Python, and a few of Vada's and Varc's constructs have no form in it: a package renaming, a fixed or decimal fixed point type, an out parameter or a scalar in out one, an access-to-subprogram parameter, an array indexed by a range that does not start at 0, an index or discriminant constraint, a type, a package, an instance or an exception declared inside a subprogram, an attribute with arguments other than Python's sum, all, any and accumulate. Vibe's printer writes a program exactly or refuses it: a translation to Vibe names each such construct where it is (B7015) and writes nothing, and a translation whose Vibe would not check is refused too, with what the check found. Keep those units in Vada or Varc, which a Vibe module imports. A loop's filter is a generator's if (for e in (e for e in m if e > 2):), a record copied from another is copy(a), as Python's name would otherwise share the object, and Ada's @ is the target again (x += 1). Vada's aggregates become Vibe's constructions ((others => 0) of a four-component array is Row([0, 0, 0, 0]), (P with delta X => 7) is replace(P, X=7)), and a call of a procedure whose out and scalar in out actuals take its results is Vibe's assignment of them (Split (7, A, B) is a, b = split(7)), which a translation to Vada or Varc writes as the call again.

GNAT and Python boundaries

--to vada --plain-ada expands supported Verada source extensions, such as filtered/lockstep pipeline forms, into ordinary Ada structures for a GNAT workflow. It is not a guarantee that all Verada library/runtime conventions or proof annotations are accepted by every Ada tool. Use a specified GNAT version/options and compare behavior within its supported domain.

Generated .vb source and generated .pyi stubs serve different purposes. A translated Vibe module imports Verada's verada module and stays within Vibe's part of Python. Stubs let a Python type checker understand declarations but are not a Python runtime; see stubs.

Translation keeps comments and writes the target's canonical layout. The Varc translator writes inclusive ranges as ..=; Varc source can also spell them .... Format Vibe output with a Python formatter if you want a different layout. Review overwritten outputs before moving generated source into the active project.