A Repository dedicated to making CBMC fit for "standard" applications
Simply:
cat file-stored-input | cbmc-golf source-file.c
or whatever you want to call the compilation result or the processed source file.
The tool is also able to pass-through the --unwind parameter to CBMC via the -u flag.
Note that cbmc needs to be in your PATH.
Note that file-stored-input must contain exactly one line for each expected declaration and must only contain valid right-hand-side values for C source-file initialisation e.g. 1 or {1,2,3}.
Simple:
clang++ cbmc-golf.cpp -o cbmc-golf -O2
or the same with g++ instead of clang.
- Print using
p("...",...), this will automatically be transpiled toprintf(with a leading newline so it won't get stripped out of the output) - call assert using
a(condition)which will also get transpiled toassert - You may not define functions that end in a
por anaor the above rules will be applied. stdio.handassert.hare included by default- To save bytes
f()followed by a new-line will be replaced byint main() { - At the end of the file a
}will always be inserted - Write your "input" above any preprocessor macros and above
f()and in the order you want your input lines to be read, they must also be terminated by only a newline (no;!) - Write your input as standard C declarations, e.g.
int Yorint arr[]orint arr[][2]and note that the input you will get will be inserted after that declaration on the right hand side of a= - For every array-input
X[]there will automatically beXldefined which holds the length of the variable-length arrayX