https://github.com/csb6/vdm2cpp
VDM-SL to C++ translator plugin
https://github.com/csb6/vdm2cpp
vdm vdm-sl
Last synced: 23 days ago
JSON representation
VDM-SL to C++ translator plugin
- Host: GitHub
- URL: https://github.com/csb6/vdm2cpp
- Owner: csb6
- License: gpl-3.0
- Created: 2024-12-29T22:00:37.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2025-01-04T20:17:16.000Z (over 1 year ago)
- Last Synced: 2025-03-03T21:56:04.106Z (over 1 year ago)
- Topics: vdm, vdm-sl
- Language: Java
- Homepage:
- Size: 47.9 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# VDM2CPP
A prototype translator of a subset of VDM-SL into C++, built as a plugin to [VDMJ](https://github.com/nickbattle/vdmj)
Intended as a small experiment and not a complete translator, but supports translating basic VDM type definitions and
function signatures into C++ equivalents.
## Types
| VDM-SL | C++ |
| ------------------------ | ------------------------------ |
| `bool` | `bool` |
| `NamedType = OtherType` | `using NamedType = OtherType;` |
| `TypeA \| TypeB` | `std::variant` |
| `TypeA * TypeB` | `std::tuple` |
| `Record :: a: A b: B` | `struct Record { A a; B b; };` |
| `[A]` | `std::optional` |
| `set of char` | `std::set` |
| `seq of char` | `std::string` |
| `seq of A` | `std::vector` |
| `map char to A` | `std::map` |
| `A -> B` | `std::function` |
Currently numeric types are not being translated properly; the idea is to translate `nat`, `int`, `rat`, etc. into
BigInt and BigFloat C++ types, and have annotations to mark VDM integer types with bounded sizes into corresponding
C++ primitive integer types.
## Functions
Currently only function signatures (not bodies) are translated. Curried functions are not translated,
and functions with parameters other than identifiers and ignore patterns are also not translated.
# License
All files in this repository are licensed under the GPLv3 license. See LICENSE for more details.