40 std::istream &instream,
41 const std::string &path,
42 std::ostream &outstream,
47 return c_preprocess(instream, outstream, message_handler);
53 std::istream &instream,
54 const std::string &path,
61 std::ostringstream o_preprocessed;
63 if(
preprocess(instream, path, o_preprocessed, message_handler))
66 std::istringstream i_preprocessed(o_preprocessed.str());
72 std::istringstream codestr(code);
76 ansi_c_parser.in=&codestr;
83 ansi_c_parser.cpp98=
false;
84 ansi_c_parser.cpp11=
false;
89 bool result=ansi_c_parser.parse();
93 ansi_c_parser.set_line_no(0);
94 ansi_c_parser.set_file(path);
95 ansi_c_parser.in=&i_preprocessed;
97 result=ansi_c_parser.parse();
108 const std::string &module,
110 const bool keep_file_local)
112 return typecheck(symbol_table, module, message_handler, keep_file_local, {});
117 const std::string &module,
119 const bool keep_file_local,
120 const std::set<irep_idt> &keep)
130 new_symbol_table, message_handler, keep_file_local, keep);
132 if(
linking(symbol_table, new_symbol_table, message_handler))
154 return std::make_unique<ansi_c_languaget>();
185 const std::string &code,
195 std::istringstream i_preprocessed(
196 "void __my_expression = (void) (\n"+code+
"\n);");
202 ansi_c_parser.in=&i_preprocessed;
209 ansi_c_parser.cpp98 =
false;
210 ansi_c_parser.cpp11 =
false;
214 bool result=ansi_c_parser.parse();
216 if(ansi_c_parser.parse_tree.items.empty())
220 expr=ansi_c_parser.parse_tree.items.front().declarator().value();
227 if(expr.
id()==ID_typecast &&
228 expr.
type().
id()==ID_empty &&
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.
~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...
void set_file(const irep_idt &file)
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.
bool ts_18661_3_Floatn_types
bool __float128_is_keyword
static std::string type2name(const typet &type, const namespacet &ns, symbol_numbert &symbol_number)