JtoC is a program used for translation of Java 8 programs to C through JBMC's GOTO program representation.
- Clone the repository and download the submodules
git clone https://github.com/staticafi/jtoc.git
cd jtoc/jbmc
git submodule update --init --recursive-
Then follow the instructions in the file
jbmc/COMPILING.mdand compile theJBMC. -
After the compilation there should be the
JBMCbinary calledjbmc(If you compiled the project using CMake approach, the binary should be on pathjbmc/build/bin/jbmc). Rename the binary intojbmc_bin. -
Move this binary into the folder
jbmc.JtoCexpects theJBMCbinary to be on pathjbmc/jbmc_bin.
Now you can start using JtoC!
You need to clone the Java benchmarks only if you want to test the JtoC. They are not the part of the source code.
To run the tests on the java benchmarks, you need to clone the java category benchmarks into folder src/java_benchmarks.
Use these commands:
git clone https://gitlab.com/sosy-lab/benchmarking/sv-benchmarks.git
mkdir java_benchmarks
mv sv-benchmarks/java/* java_benchmarksAfter cloning this repository, you can use the JtoC program like this:
python3 ./src/jtoc.py <path_to_class_name> [<c_file_name>]- <path_to_class_name> is the name of the class residing in the file named
<class_name>.java.JtoCexpects this file to be in the subdirectory oftests/. - <c_file_name> is optional name of the file into which the output of
JtoCwill be put.
Use the command
python3 ./src/run_unit_tests.pyto run the unit tests located in tests/ folder.
Use the command
python3 ./src/run_benchmarks.pyto run the java benchmarks. You need to clone the java benchmarks into the src/java_benchmarks folder!