How To Use ComenC
From ClearSy Tools
To translate a B0 model into C code, you need to:
- have, at least, a B0 model and its abstract machine,
- create a file describing the components you want to translate.
This file (extension .dba) contains as many lines as components your project is composed of. A line contains the name of the component and its complete path, separated by a blank space.
For example, if your project is composed of an abstract machine M0.mch and its implementation M1.imp (both files are loacted in the directory /home/user/comenc) , then the related project.dba file contains:
M0 /home/user/comenc/M0.mch M1 /home/user/comenc/M1.imp
This file (project.dba) can be generated automatically with the make_dba.sh script (located in Comenc/). Change to the directory containing the models to translate then execute the make_dba.sh script:
User> cd /home/user/comenc User> <ComenC_install_dir>/bin/make_dba.sh
To initiate the translation process, type:
<ComenC_install_dir>/bin/linux/b2c -C . -p project.dba -b <Comenc_install_dir>/bin/bpp.sh -i <component_name>
For example, considering that ComenC is installed in /home/comenc, in order to translate the component M1 located in /home/user/comenc, type in:
/home/comenc/bin/linux/b2c -C . -p project.dba -b /home/comenc/bin/bpp.sh -i M1