Closed schuessf closed 8 months ago
Is the wrapper
BacktranslatedExpression
useful outside ofBoogie2ACSL
?
Currently not, it is mainly used for two different reasons:
BacktranslatedExpression
has a CType
that might be usedExpression
would be used as a return, we need to prefix the full package name in CACSL2BoogieBacktranslator
, since it already uses Boogie-Expression
I see you removed
containsProcedureCall
, but I didn't quite grasp how the functionality works now. Could you explain?
We do not create any function-calls in our ACSL-backtranslation (I am not entirely sure, if our ACSL currently allows this). So this is no more needed.
Previously we used the CLocation
of the Boogie-expression in the backtranslation. We only translated IdentifierExpression
, if it contained an IASTDeclaration
or IASTExpression
. This way we wanted to translate variable, if they did not represent a C-variable, but another expression (e.g. f(x)
, x++
). I already removed this backtranslation of non-identifiers in 5f661d159df0abe32d0264e1ae9f08a3380d6099, because it was not handled correctly anyway and we should not have C-expressions with side-effects in invariants (x++ == f(x)
is a bad invariant 😄). Now we backtranslate variables only to C-variables if possible and independant of the location.
Currently our backtranslation from Boogie to C (
CACSL2BoogieBacktranslator
) returns anIASTExpression
. However, we return our own implementationFakeExpression
in most cases, which is bascially a string. Therefore we do not create an actual AST, but do some string concatenation instead.Therefore this PR aims to translate Boogie to an actual AST in ACSL. To output these ACSL-expressions in witnesses or on the console the already existing class
ACSLPrettyPrinter
is used, which might be extended/improved (e.g. avoid unnecessary parentheses based on the operator precedence). Additionally I extracted a classBoogie2ACSL
for this to extract functionality fromCACSL2BoogieBacktranslator
and translate the Boogie expressions mostly independent from the underlying C-Location.Also I fixed some issues of the backtranslation:
Before I rebased this branched, I checked if the new backtranslation via ACSL still produced the same String as the current backtranslation, see the results on Jenkins