42 {ID_notequal, {
u8"\u2260"}},
43 {ID_and, {
u8"\u2227"}},
44 {ID_or, {
u8"\u2228"}},
45 {ID_xor, {
u8"\u2295"}},
46 {ID_implies, {
u8"\u21d2"}},
47 {ID_le, {
u8"\u2264"}},
48 {ID_ge, {
u8"\u2265"}},
69 (sub_expr.
id() == ID_mult || sub_expr.
id() == ID_div) &&
70 (expr.
id() == ID_plus || expr.
id() == ID_minus))
75 (sub_expr.
id() == ID_equal || sub_expr.
id() == ID_notequal ||
76 sub_expr.
id() == ID_lt || sub_expr.
id() == ID_gt ||
77 sub_expr.
id() == ID_le || sub_expr.
id() == ID_ge) &&
78 (expr.
id() == ID_and || expr.
id() == ID_or))
83 (sub_expr.
id() == ID_plus || sub_expr.
id() == ID_minus ||
84 sub_expr.
id() == ID_mult || sub_expr.
id() == ID_div) &&
85 (expr.
id() == ID_equal || expr.
id() == ID_notequal || expr.
id() == ID_lt ||
86 expr.
id() == ID_gt || expr.
id() == ID_le || expr.
id() == ID_ge))
102 if(src.
id() == ID_equal &&
to_equal_expr(src).op0().type().
id() == ID_bool)
104 operator_str =
u8"\u21d4";
110 operator_str = infix_map_it->second.rep;
113 for(
const auto &op : src.
operands())
118 os <<
' ' << operator_str <<
' ';
145 if(src.
id() == ID_not)
147 else if(src.
id() == ID_unary_minus)
149 else if(src.
id() == ID_count_leading_zeros)
151 else if(src.
id() == ID_count_trailing_zeros)
153 else if(src.
id() == ID_find_first_set)
156 return os << src.
pretty();
159 return os <<
'(' <<
format(src.
op()) <<
')';
175 auto type = src.
type().
id();
182 return os <<
"false";
184 return os << src.
pretty();
187 type == ID_unsignedbv || type == ID_signedbv || type == ID_c_bool ||
188 type == ID_c_bit_field)
189 return os << *numeric_cast<mp_integer>(src);
190 else if(type == ID_integer)
192 else if(type == ID_string)
194 else if(type == ID_floatbv)
196 else if(type == ID_pointer)
199 return os << ID_NULL;
204 return os <<
"INVALID-POINTER";
211 return os <<
"pointer(0x" <<
integer2string(int_value, 16) <<
", "
215 else if(type == ID_c_enum_tag)
220 return os << src.
pretty();
228 if(s.first != ID_type && s.first != ID_C_source_location)
229 os <<
' ' << s.first <<
"=\"" << s.second.id() <<
'"';
236 for(
const auto &op : expr.
operands())
261 std::function<std::ostream &(std::ostream &,
const exprt &)>;
262 using expr_mapt = std::unordered_map<irep_idt, formattert>;
281 auto multi_ary_expr =
282 [](std::ostream &os,
const exprt &expr) -> std::ostream & {
292 auto binary_infix_expr =
293 [](std::ostream &os,
const exprt &expr) -> std::ostream & {
297 expr_map[ID_lt] = binary_infix_expr;
298 expr_map[ID_gt] = binary_infix_expr;
299 expr_map[ID_ge] = binary_infix_expr;
300 expr_map[ID_le] = binary_infix_expr;
301 expr_map[ID_div] = binary_infix_expr;
302 expr_map[ID_minus] = binary_infix_expr;
303 expr_map[ID_implies] = binary_infix_expr;
304 expr_map[ID_equal] = binary_infix_expr;
305 expr_map[ID_notequal] = binary_infix_expr;
307 auto binary_prefix_expr =
308 [](std::ostream &os,
const exprt &expr) -> std::ostream & {
314 expr_map[ID_ieee_float_equal] = binary_prefix_expr;
315 expr_map[ID_ieee_float_notequal] = binary_prefix_expr;
317 auto unary_expr = [](std::ostream &os,
const exprt &expr) -> std::ostream & {
322 expr_map[ID_unary_minus] = unary_expr;
324 auto unary_with_parentheses_expr =
325 [](std::ostream &os,
const exprt &expr) -> std::ostream & {
329 expr_map[ID_isnan] = unary_with_parentheses_expr;
330 expr_map[ID_isinf] = unary_with_parentheses_expr;
331 expr_map[ID_isfinite] = unary_with_parentheses_expr;
332 expr_map[ID_isnormal] = unary_with_parentheses_expr;
335 [](std::ostream &os,
const exprt &expr) -> std::ostream & {
339 expr_map[ID_floatbv_plus] = ternary_expr;
340 expr_map[ID_floatbv_minus] = ternary_expr;
341 expr_map[ID_floatbv_mult] = ternary_expr;
342 expr_map[ID_floatbv_div] = ternary_expr;
343 expr_map[ID_floatbv_mod] = ternary_expr;
346 [](std::ostream &os,
const exprt &expr) -> std::ostream & {
351 [](std::ostream &os,
const exprt &expr) -> std::ostream & {
353 return os <<
"address_of(" <<
format(address_of.object()) <<
')';
356 expr_map[ID_annotated_pointer_constant] =
357 [](std::ostream &os,
const exprt &expr) -> std::ostream & {
359 return os <<
format(annotated_pointer.symbolic_pointer());
363 [](std::ostream &os,
const exprt &expr) -> std::ostream & {
365 <<
format(expr.type()) <<
')';
369 [](std::ostream &os,
const exprt &expr) -> std::ostream & {
371 return os <<
"floatbv_typecast(" <<
format(floatbv_typecast_expr.op())
372 <<
", " <<
format(floatbv_typecast_expr.type()) <<
", "
373 <<
format(floatbv_typecast_expr.rounding_mode()) <<
')';
377 [](std::ostream &os,
const exprt &expr) -> std::ostream & {
379 return os << expr.id() <<
'(' <<
format(byte_extract_expr.op()) <<
", "
380 <<
format(byte_extract_expr.offset()) <<
", "
381 <<
format(byte_extract_expr.type()) <<
')';
384 expr_map[ID_byte_extract_little_endian] = byte_extract;
385 expr_map[ID_byte_extract_big_endian] = byte_extract;
387 auto byte_update = [](std::ostream &os,
const exprt &expr) -> std::ostream & {
389 return os << expr.id() <<
'(' <<
format(byte_update_expr.op()) <<
", "
390 <<
format(byte_update_expr.offset()) <<
", "
391 <<
format(byte_update_expr.value()) <<
", "
392 <<
format(byte_update_expr.type()) <<
')';
395 expr_map[ID_byte_update_little_endian] = byte_update;
396 expr_map[ID_byte_update_big_endian] = byte_update;
399 [](std::ostream &os,
const exprt &expr) -> std::ostream & {
405 [](std::ostream &os,
const exprt &expr) -> std::ostream & {
410 [](std::ostream &os,
const exprt &expr) -> std::ostream & {
412 return os <<
format(index_expr.array()) <<
'[' <<
format(index_expr.index())
417 [](std::ostream &os,
const exprt &expr) -> std::ostream & {
422 [](std::ostream &os,
const exprt &expr) -> std::ostream & {
437 [](std::ostream &os,
const exprt &expr) -> std::ostream & {
451 expr_map[ID_let] = [](std::ostream &os,
const exprt &expr) -> std::ostream & {
458 const auto &values = let_expr.values();
459 auto values_it = values.begin();
460 for(
auto &v : let_expr.variables())
471 return os <<
" IN " <<
format(let_expr.where());
475 [](std::ostream &os,
const exprt &expr) -> std::ostream & {
482 for(
auto &v : lambda_expr.variables())
492 return os <<
" . " <<
format(lambda_expr.where());
495 auto compound = [](std::ostream &os,
const exprt &expr) -> std::ostream & {
500 for(
const auto &op : expr.operands())
517 [](std::ostream &os,
const exprt &expr) -> std::ostream & {
519 return os <<
"array_of(" <<
format(array_of_expr.what()) <<
')';
522 expr_map[ID_if] = [](std::ostream &os,
const exprt &expr) -> std::ostream & {
524 return os <<
'(' <<
format(if_expr.cond()) <<
" ? "
525 <<
format(if_expr.true_case()) <<
" : "
526 <<
format(if_expr.false_case()) <<
')';
530 [](std::ostream &os,
const exprt &expr) -> std::ostream & {
531 return os <<
'"' << expr.get_string(ID_value) <<
'"';
535 [](std::ostream &os,
const exprt &expr) -> std::ostream & {
537 os <<
format(function_application_expr.function()) <<
'(';
539 for(
auto &argument : function_application_expr.arguments())
552 [](std::ostream &os,
const exprt &expr) -> std::ostream & {
555 if(dereference_expr.pointer().id() != ID_symbol)
556 os <<
'(' <<
format(dereference_expr.pointer()) <<
')';
558 os <<
format(dereference_expr.pointer());
563 [](std::ostream &os,
const exprt &expr) -> std::ostream & {
565 return os <<
"saturating-(" <<
format(saturating_minus.lhs()) <<
", "
566 <<
format(saturating_minus.rhs()) <<
')';
570 [](std::ostream &os,
const exprt &expr) -> std::ostream & {
572 return os <<
"saturating+(" <<
format(saturating_plus.lhs()) <<
", "
573 <<
format(saturating_plus.rhs()) <<
')';
577 [](std::ostream &os,
const exprt &expr) -> std::ostream & {
579 return os <<
u8"\u275d" << object_address_expr.object_identifier()
584 [](std::ostream &os,
const exprt &expr) -> std::ostream & {
586 return os <<
"object_size(" <<
format(object_size_expr.op()) <<
')';
590 [](std::ostream &os,
const exprt &expr) -> std::ostream & {
592 return os <<
"pointer_offset(" <<
format(pointer_offset_expr.op()) <<
')';
596 [](std::ostream &os,
const exprt &expr) -> std::ostream & {
598 return os <<
format(field_address_expr.base()) <<
u8".\u275d"
599 << field_address_expr.component_name() <<
u8"\u275e";
602 fallback = [](std::ostream &os,
const exprt &expr) -> std::ostream & {
622 return formatter(os, expr);