9#include <nlohmann/json.hpp>
41 if (type.id() ==
"symbol")
44 if (!type.is_struct())
49 return tag ==
"complex" || tag ==
"tag-complex";
65 return v.type() == dt ? v2 : typecast2tc(dt2, v2);
68 std::vector<expr2tc> members{to_double2(real), to_double2(imag)};
75 if (
value.statement() ==
"cpp-throw")
106 not2tc(equality2tc(member2tc(dt2, complex2,
"real"), zero2));
108 not2tc(equality2tc(member2tc(dt2, complex2,
"imag"), zero2));
167 std::string
get_var_type(
const std::string &var_name)
const;
187 typet get_typet(
const std::string &ast_type,
size_t type_size = 0)
const;
247 const exprt &tagged_type_id,
248 const typet &literal_type)
const;
305 const std::string &ast_type,
307 size_t type_size)
const;
315 const std::string &class_name,
316 const std::string &expected_base)
const;
324 exprt get_expr_helper(
const nlohmann::json &
json)
const;
327 bool are_types_compatible(
const typet &t1,
const typet &t2)
const;
330 typet get_canonical_string_type(
const typet &t)
const;
333 typet get_typet_from_call_func(
const nlohmann::json &func)
const;
void base_type(type2tc &type, const namespacet &ns)
Definition base_type.cpp:6
typet long_long_int_type()
Definition c_types.cpp:101
typet double_type()
Definition c_types.cpp:240
const std::string & as_string() const
Definition irep_idt.h:138
const irep_idt & tag() const
Definition irep.h:192
typet & type()
Definition irep.h:153
bool is_bool() const
Definition irep.h:1129
Main converter for transforming Python AST into ESBMC's intermediate representation.
Definition python_converter.h:76
Definition std_types.h:232
Definition std_types.h:87
const componentst & components() const
Definition std_types.h:184
const irep_idt & get_identifier() const
Definition std_types.h:44
typet build_optional_type(const typet &base_type) const
Definition type_handler.cpp:1624
typet build_array(const typet &sub_type, const size_t size) const
This method creates a typet representing a statically sized array.
Definition type_handler.cpp:439
exprt ptr_free_arg(const exprt &payload, const typet &elem_type) const
Definition type_handler.cpp:119
exprt tagged_scalar_byte_size(const exprt &value) const
Definition type_handler.cpp:1317
static typet python_int_typet()
Lowering for Python int — arbitrarily large in the language spec.
Definition type_handler.cpp:69
exprt tagged_scalar_type_matches(const exprt &tagged_type_id, const typet &literal_type) const
Definition type_handler.cpp:1300
std::optional< typet > scalar_array_element_type(const nlohmann::json &elem) const
Definition type_handler.cpp:896
typet get_typet(const std::string &ast_type, size_t type_size=0) const
Definition type_handler.cpp:523
size_t get_type_width(const typet &type) const
Definition type_handler.cpp:1564
static typet class_value_type()
A class used as a value that is not known statically, as a variable bound to one of several classes i...
Definition type_handler.cpp:1691
typet get_tagged_object_type() const
Definition type_handler.cpp:1277
static bool is_class_value_type(const typet &type)
Definition type_handler.cpp:1699
exprt tagged_scalar_type_id(const typet &type) const
Definition type_handler.cpp:1291
typet get_generic_typet(const std::string &ast_type, size_t bracket_pos, size_t type_size) const
Convert a Python AST type to an ESBMC internal irep type.
Definition type_handler.cpp:509
typet get_list_element_type() const
Definition type_handler.cpp:1348
bool is_string_type(const typet &t) const
Definition type_handler.cpp:1334
std::string resolve_builtin_alias(const std::string &name) const
Resolves Alias = builtin (e.g.
Definition type_handler.cpp:841
std::string get_operand_type(const nlohmann::json &operand) const
This method inspects the JSON representation of a Python operand node and attempts to infer its type ...
Definition type_handler.cpp:1366
bool is_2d_array(const nlohmann::json &arr) const
Definition type_handler.cpp:1530
bool is_pointer_record(const typet &t) const
Definition type_handler.cpp:106
bool has_multiple_types(const nlohmann::json &container) const
Definition type_handler.cpp:1071
std::string type_to_string(const typet &t) const
This utility maps internal ESBMC types to their corresponding Python type strings.
Definition type_handler.cpp:195
std::vector< int > get_array_type_shape(const typet &array_type) const
Definition type_handler.cpp:452
std::string get_var_type(const std::string &var_name) const
Definition type_handler.cpp:267
typet get_slice_type() const
Returns the registered struct type used for Python slice objects.
Definition type_handler.cpp:1353
bool is_numeric_scalar_type(const typet &t) const
Definition type_handler.cpp:1339
bool class_derives_from(const std::string &class_name, const std::string &expected_base) const
Definition type_handler.cpp:1651
const typet get_list_type() const
Definition type_handler.cpp:1266
std::string get_var_classname(const nlohmann::json &value_node) const
Definition type_handler.cpp:351
static unsigned python_int_width()
Bit width of python_int_typet() — exposed for callsites that need to compute representable ranges (e....
Definition type_handler.cpp:62
type_handler(const python_converter &converter)
Definition type_handler.cpp:76
bool is_pointer_free(const typet &t) const
Definition type_handler.cpp:87
std::string get_python_type_name(const typet &t) const
Returns the Python type name for an ESBMC type, as produced by type().
Definition type_handler.cpp:239
const typet get_dict_type() const
Definition type_handler.cpp:1676
bool is_constructor_call(const nlohmann::json &json) const
Definition type_handler.cpp:134
bool is_tagged_scalar_type(const typet &t) const
Definition type_handler.cpp:1286
int get_array_dimensions(const nlohmann::json &arr) const
Definition type_handler.cpp:1538
Definition std_expr.h:650
@ instance
Definition converter_compare.cpp:886
irep_container< type2t > type2tc
Definition irep2.h:430
irep_container< expr2t > expr2tc
Definition irep2.h:431
nlohmann::json json
Definition json.cpp:12
exprt migrate_expr_back(const expr2tc &ref)
Definition migrate.cpp:3949
void migrate_expr(const exprt &expr, expr2tc &new_expr_ref)
Definition migrate.cpp:1512
type2tc migrate_type(const typet &type)
Definition migrate.cpp:557
const struct_typet & to_struct_type(const typet &type)
Definition std_types.h:241
const symbol_typet & to_symbol_type(const typet &type)
Cast a generic typet to a symbol_typet.
Definition std_types.h:60
const struct_typet & get_complex_struct_type()
Definition type_handler.h:25
const typet & cached_double_type()
Definition type_handler.h:17
exprt make_complex(const exprt &real, const exprt &imag)
Definition type_handler.h:52
exprt promote_to_complex(const exprt &value)
Definition type_handler.h:73
bool is_complex_type(const typet &type)
Definition type_handler.h:39
exprt complex_to_bool_expr(const exprt &complex_expr)
Definition type_handler.h:90