How utwente-fmt/vercors works
Overall Structure and Main Components
• Frontend Parsers and Language Adapters:
– Their task is to convert source programs into an intermediate abstract syntax tree (AST).
• Intermediate Representation (IR) and the Core “col” Module:
– The “src/col/vct” directory contains the core AST definitions, node implementations, declaration modules, expression constructs, and type definitions. This layer represents a common IR used throughout the toolset.
• Rewriting and Transformation Passes:
– The project has many rewriting rules and transformation passes (located under “src/rewrite/vct/rewrite” and subdirectories such as “lang”, “cfg”, “rasi”, “veymont”, and “adt”). These are used to gradually simplify, resolve types, disambiguate ambiguities, and generate the final proof obligations.
• Verification Engine and Status Stages:
– The “src/main/vct” folder contains the main entry (the “Main.scala”) as well as several “stages” (e.g., Parsing, Resolution, Transformation, Expected Errors, and Output), which process the IR and ultimately drive the verification process.
• Backend Integration and External Dependencies:
– In addition, a “viper” subproject exists (under “src/viper”) which handles, for instance, translation to the Silver verification language and integration with Viper’s toolchain.
• Utility, Logging, and Platform-Specific Modules:
– Several directories (such as “src/hre” and “src/util”) provide logging, caching, platform abstraction, and helper routines to facilitate reporting, progress indication, and debugging.
Relationships and Data Flows
– User supplies a file (e.g., a Java, C, or PVL program) via the command‐line run script (located in “bin”).
• Next comes the Frontend Parser:
– The selected language-specific parser (ANTLR-based) reads the source code and produces an AST.
• Common IR Construction:
– The AST is converted into the “col” model (the VCT core) and enriched with type information, contracts, and annotations.
• Transformation / Rewriting Pipeline:
– Several rewriting passes are performed sequentially – e.g., disambiguation, inlining, type coercion, and handling of specific concurrency constructs.
• Verification Stage:
– After transformation, the verification engine generates proof obligations or translates the IR to intermediate languages (like Boogie or SMT constraints) that external solvers (Z3, Boogie) process.
• Output Layer:
– The tool then produces a verification result with error messages or success notifications.
Architectural Patterns and Design Principles
• Layered Architecture:
• Modularity and Extensibility:
– Modules are well separated (for instance “rewrite”, “parsers”, “vct”, “viper”). This encourages new frontends or new transformation passes without disturbing the overall architecture.
• Use of External Tools:
– Components that interface with external solvers are clearly isolated, promoting a clean boundary between the internal analysis and external proof checking.