C for B (abbreviated as C4B) is a C code generator for Atelier B 4.0. Yes, another one …
The ComenC experiment was not successful for several reasons:
- ComenC code generator implements too many restrictions, issued form industrial safety critical code generators, that prevent the generation of C code in many cases or require to notably modify the B models.
- The underlying technology is outdated (Cocktail) and requires old machines to compile properly.
- Several bugs difficult to solve without redesigning the overall software.
Hence a new code generator has been designed, based on the B Compiler this time, and embedding less constraints to make it (we hope) more usable.
C4B is a translator, transforming a B model into a C program. It gathers experience gained during R&D projects as well as application to industry-strength case-studies.
C4B requires B models:
- 100% proved
- B0-checked: types used in the implementable model comply with the ones supported by C4B
C4B is integrated to Atelier B. However you could develop/contribute to a new version of C4B for experiment/bug correction. Hence it requires specific installation and use outside Atelier B. Basically you need to download C4B source code and ICU library (providing support for Unicode), and to compile it. Nothing too difficult.
Tutorial: How to compile C4B ?
And then launch C4B in a terminal on your existing B projects.
C4B has been released as open source software (GPL v3.0) and is hosted on sourceforge.