39 const std::string &path,
52 const std::string &path,
70 std::istringstream
codestr(code);
76 ansi_c_parser.ts_18661_3_Floatn_types=
config.
ansi_c.ts_18661_3_Floatn_types;
77 ansi_c_parser.__float128_is_keyword =
config.
ansi_c.__float128_is_keyword;
81 ansi_c_parser.cpp98=
false;
82 ansi_c_parser.cpp11=
false;
92 bool result=ansi_c_parser.parse();
96 ansi_c_parser.set_line_no(0);
97 ansi_c_parser.set_file(path);
100 result=ansi_c_parser.parse();
111 const std::string &
module,
113 const bool keep_file_local)
115 return typecheck(symbol_table,
module, message_handler, keep_file_local, {});
120 const std::string &
module,
122 const bool keep_file_local,
123 const std::set<irep_idt> &
keep)
133 new_symbol_table, message_handler, keep_file_local,
keep);
135 if(
linking(symbol_table, new_symbol_table, message_handler))
157 return std::make_unique<ansi_c_languaget>();
188 const std::string &code,
199 "void __my_expression = (void) (\n"+code+
"\n);");
206 ansi_c_parser.for_has_scope =
config.
ansi_c.for_has_scope;
207 ansi_c_parser.ts_18661_3_Floatn_types=
config.
ansi_c.ts_18661_3_Floatn_types;
208 ansi_c_parser.__float128_is_keyword =
config.
ansi_c.__float128_is_keyword;
209 ansi_c_parser.float16_type =
config.
ansi_c.float16_type;
212 ansi_c_parser.cpp98 =
false;
213 ansi_c_parser.cpp11 =
false;
217 bool result=ansi_c_parser.parse();
219 if(ansi_c_parser.parse_tree.items.empty())
223 expr=ansi_c_parser.parse_tree.items.front().declarator().value();
bool ansi_c_entry_point(symbol_table_baset &symbol_table, message_handlert &message_handler, const c_object_factory_parameterst &object_factory_parameters)
void ansi_c_internal_additions(std::string &code, bool support_float16_type)
std::unique_ptr< languaget > new_ansi_c_language()
void ansi_c_scanner_init(ansi_c_parsert &)
bool ansi_c_typecheck(ansi_c_parse_treet &ansi_c_parse_tree, symbol_table_baset &symbol_table, const std::string &module, message_handlert &message_handler)
ANSI-C Language Type Checking.
bool c_preprocess(std::istream &instream, std::ostream &outstream, message_handlert &message_handler)
ANSI-C preprocessing.
ait supplies three of the four components needed: an abstract interpreter (in this case handling func...
~ansi_c_languaget() override
std::set< std::string > extensions() const override
void show_parse(std::ostream &out, message_handlert &) override
bool from_type(const typet &type, std::string &code, const namespacet &ns) override
Formats the given type in a language-specific way.
bool from_expr(const exprt &expr, std::string &code, const namespacet &ns) override
Formats the given expression in a language-specific way.
bool to_expr(const std::string &code, const std::string &module, exprt &expr, const namespacet &ns, message_handlert &message_handler) override
Parses the given string into an expression.
void modules_provided(std::set< std::string > &modules) override
bool type_to_name(const typet &type, std::string &name, const namespacet &ns) override
Encodes the given type in a language-specific way.
bool typecheck(symbol_table_baset &symbol_table, const std::string &module, message_handlert &message_handler, const bool keep_file_local) override
typecheck without removing specified entries from the symbol table
bool preprocess(std::istream &instream, const std::string &path, std::ostream &outstream, message_handlert &message_handler) override
ANSI-C preprocessing.
bool generate_support_functions(symbol_table_baset &symbol_table, message_handlert &message_handler) override
Create language-specific support functions, such as __CPROVER_start, __CPROVER_initialize and languag...
ansi_c_parse_treet parse_tree
c_object_factory_parameterst object_factory_params
bool parse(std::istream &instream, const std::string &path, message_handlert &message_handler) override
void swap(ansi_c_parse_treet &other)
void output(std::ostream &out) const
struct configt::ansi_ct ansi_c
Base class for all expressions.
typet & type()
Return the type of the expression.
const irep_idt & id() const
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
The symbol table base class interface.
The type of an expression, extends irept.
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)
std::string get_base_name(const std::string &in, bool strip_suffix)
cleans a filename from path and extension
bool linking(symbol_table_baset &dest_symbol_table, const symbol_table_baset &new_symbol_table, message_handlert &message_handler)
Merges the symbol table new_symbol_table into dest_symbol_table, renaming symbols from new_symbol_tab...
void remove_internal_symbols(symbol_table_baset &symbol_table, message_handlert &mh, const bool keep_file_local)
Removes internal symbols from a symbol table A symbol is EXPORTED if it is a.
Remove symbols that are internal only.
const typecast_exprt & to_typecast_expr(const exprt &expr)
Cast an exprt to a typecast_exprt.
static std::string type2name(const typet &type, const namespacet &ns, symbol_numbert &symbol_number)