31#define NOT_POSTFIX 'N'
37#define OPERAND_SEPARATOR ' '
40#define LINE_SEPARATOR ";\n"
44#define NESTING_OPEN_LINE_SEPARATOR "(;\n"
48#define NESTING_CLOSED_LINE_SEPARATOR ");\n"
51#define REFERENCE_FLAG '#'
54#define SCOPE_SEPARATOR "::"
63static std::vector<exprt>
66 std::vector<exprt> result;
70 result.push_back(lhs);
76 result.push_back(lhs);
83 result.push_back(rhs);
89 result.push_back(rhs);
156 std::vector<exprt> operands = expr.
operands();
162 std::vector<exprt> operands = expr.
operands();
168 std::vector<exprt> operands = expr.
operands();
174 std::vector<exprt> operands = expr.
operands();
180 std::vector<exprt> operands =
218 std::vector<exprt> &operands,
219 const char operation)
231 const std::vector<exprt> &operands,
232 const char operation)
234 for(
const exprt &op : operands)
270 for(
auto it{begin(operands)}; it != end(operands); ++it)
301 if(
pos != std::string::npos)
ait supplies three of the four components needed: an abstract interpreter (in this case handling func...
Boolean AND All operands must be boolean, and the result is always boolean.
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
Class for saving the internal state of the conversion process.
void convert_multiary_bool(std::vector< exprt > &operands, const char operation)
Iterates through all the given operands and converts them depending on the operation.
void convert_bool_operand(const exprt &op)
Converts a single boolean operand and introduces an additional nesting layer if needed.
std::string convert(const exprt &expr)
Invokes the conversion process for the given expression and calls itself recursively in the process.
void convert_multiary_bool_operands(const std::vector< exprt > &operands, const char operation)
Iterates through all the given operands and converts them depending on the operation.
void convert_first_non_trivial_operand(std::vector< exprt > &operands)
Iterates through all the given operands in search for the first non-trivial operand (that encloses al...
bool is_reference
Flag to specify if the next symbol to convert is a reference to a variable.
expr2stlt(const namespacet &ns)
Creates a new instance of the converter.
const namespacet & ns
Contains the symbol table of the current program to convert.
irep_idt id_shorthand(const irep_idt &identifier)
Returns the given identifier in a form that is compatible with STL by looking up the symbol or cuttin...
std::stringstream result
Used for saving intermediate results of the conversion process.
bool inside_bit_string
Internal representation of the FC bit in STL.
Base class for all expressions.
bool is_boolean() const
Return whether the expression represents a Boolean.
const irep_idt & id() const
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
Boolean OR All operands must be boolean, and the result is always boolean.
Expression to hold a symbol (variable)
const irep_idt & get_identifier() const
irep_idt irep_idt base_name
Name of module the symbol belongs to.
The type of an expression, extends irept.
Boolean XOR All operands must be boolean, and the result is always boolean.
std::string expr2c(const exprt &expr, const namespacet &ns, const expr2c_configurationt &configuration)
std::string type2c(const typet &type, const namespacet &ns, const expr2c_configurationt &configuration)
#define NESTING_OPEN_LINE_SEPARATOR
Separator for the end of an instruction that introduces a new layer of nesting.
#define SCOPE_SEPARATOR
CBMC-internal separator for variable scopes.
#define NOT_POSTFIX
Postfix for any negated boolean instruction.
#define REFERENCE_FLAG
Prefix for the reference to any variable.
#define OPERAND_SEPARATOR
Separator between the instruction code and it's operand.
#define OR
STL code for an OR instruction.
#define XOR
STL code for a XOR instruction.
std::string expr2stl(const exprt &expr, const namespacet &ns)
Converts a given expression to human-readable STL code.
std::string type2stl(const typet &type, const namespacet &ns)
Converts a given type to human-readable STL code.
#define LINE_SEPARATOR
Separator between the end of an instruction and the next one.
#define NESTING_CLOSED_LINE_SEPARATOR
Separator for the end of an instruction that closes a nesting layer.
#define AND
STL code for an AND instruction.
static std::vector< exprt > instrument_equal_operands(const exprt &lhs, const exprt &rhs)
Modifies the parameters of a binary equal expression with the help of its symmetry properties.
#define NOT
STL code for a NOT instruction.
static bool is_not_bool(const exprt &expr)
Checks if the expression or one of its parameters is not of type bool.
const std::string & id2string(const irep_idt &d)
bool is_reference(const typet &type)
Returns true if the type is a reference.
#define PRECONDITION(CONDITION)
API to expression classes.
const and_exprt & to_and_expr(const exprt &expr)
Cast an exprt to a and_exprt.
const xor_exprt & to_xor_expr(const exprt &expr)
Cast an exprt to a xor_exprt.
const or_exprt & to_or_expr(const exprt &expr)
Cast an exprt to a or_exprt.
const notequal_exprt & to_notequal_expr(const exprt &expr)
Cast an exprt to an notequal_exprt.
const not_exprt & to_not_expr(const exprt &expr)
Cast an exprt to an not_exprt.
const symbol_exprt & to_symbol_expr(const exprt &expr)
Cast an exprt to a symbol_exprt.
const equal_exprt & to_equal_expr(const exprt &expr)
Cast an exprt to an equal_exprt.
bool has_suffix(const std::string &s, const std::string &suffix)