41 std::istream &instream,
42 const std::string &path,
43 std::ostream &outstream,
48 return c_preprocess(instream, outstream, message_handler);
54 std::istream &instream,
55 const std::string &path,
62 std::ostringstream o_preprocessed;
64 if(
preprocess(instream, path, o_preprocessed, message_handler))
67 std::istringstream i_preprocessed(o_preprocessed.str());
73 std::istringstream codestr(code);
77 ansi_c_parser.
in=&codestr;
84 ansi_c_parser.
cpp98=
false;
85 ansi_c_parser.
cpp11=
false;
95 bool result=ansi_c_parser.
parse();
101 ansi_c_parser.
in=&i_preprocessed;
103 result=ansi_c_parser.
parse();
119 for(
auto it = symbol_table.
begin(); it != symbol_table.
end(); ++it)
121 const symbolt &symbol = it->second;
127 symbolt &writeable_symbol = it.get_writeable_symbol();
135 if(array_type_updates.
empty())
139 for(
auto it = symbol_table.
begin(); it != symbol_table.
end(); ++it)
142 !it->second.is_type && !it->second.is_macro &&
143 it->second.value.is_not_nil())
145 array_type_updates(it.get_writeable_symbol().value);
152 const std::string &module,
154 const bool keep_file_local)
156 return typecheck(symbol_table, module, message_handler, keep_file_local, {});
161 const std::string &module,
163 const bool keep_file_local,
164 const std::set<irep_idt> &keep)
180 new_symbol_table, message_handler, keep_file_local, keep);
182 if(
linking(symbol_table, new_symbol_table, message_handler))
204 return std::make_unique<ansi_c_languaget>();
235 const std::string &code,
245 std::istringstream i_preprocessed(
246 "void __my_expression = (void) (\n"+code+
"\n);");
252 ansi_c_parser.
in=&i_preprocessed;
259 ansi_c_parser.
cpp98 =
false;
260 ansi_c_parser.
cpp11 =
false;
264 bool result=ansi_c_parser.
parse();
277 if(expr.
id()==ID_typecast &&
278 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)
static void adjust_tentative_array_definitions(symbol_table_baset &symbol_table)
Adjust non-extern file-scope incomplete array definitions (tentative definitions without a size) to a...
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.
unsignedbv_typet size_type()
~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
bool ts_18661_3_Floatn_types
bool __float128_is_keyword
ansi_c_parse_treet parse_tree
const exprt & size() const
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)
void set_line_no(unsigned _line_no)
Expression to hold a symbol (variable).
The symbol table base class interface.
virtual iteratort begin()=0
virtual iteratort end()=0
class symbol_exprt symbol_expr() const
Produces a symbol_exprt for a symbol.
typet type
Type of symbol.
The type of an expression, extends irept.
void insert(const symbol_exprt &old_expr, const exprt &new_expr)
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.
const array_typet & to_array_type(const typet &type)
Cast a typet to an array_typet.
static std::string type2name(const typet &type, const namespacet &ns, symbol_numbert &symbol_number)