17 language(rhs.language==nullptr?nullptr:rhs.language->new_language()),
18 filename(rhs.filename)
48 file.second.language->show_parse(out);
59 std::ifstream infile(
file.first);
79 file.second.get_modules();
87 const bool keep_file_local,
94 if(
file.second.language->interfaces(symbol_table))
100 unsigned collision_counter=0;
107 for(language_filet::modulest::const_iterator
108 mo_it=modules.begin();
109 mo_it!=modules.end();
113 std::string module_name=*mo_it;
117 module_name=*mo_it+
"#"+std::to_string(collision_counter);
122 module.file=&file.second;
123 module.name=module_name;
125 std::pair<std::string, language_modulet>(module.
name, module));
133 if(
file.second.modules.empty())
135 if(
file.second.language->can_keep_file_local())
137 if(
file.second.language->typecheck(symbol_table,
"", keep_file_local))
142 if(
file.second.language->typecheck(symbol_table,
""))
148 std::unordered_set<irep_idt> lazy_method_ids;
149 file.second.language->methods_provided(lazy_method_ids);
150 for(
const auto &
id : lazy_method_ids)
160 symbol_table, module.second, keep_file_local, message_handler))
175 if(
file.second.language->generate_support_functions(symbol_table))
189 if(
file.second.language->final(symbol_table))
200 if(
file.second.language->interfaces(symbol_table))
209 const std::string &module,
210 const bool keep_file_local,
215 module_mapt::iterator it=
module_map.find(module);
220 log.
error() <<
"found no file that provides module " <<
module
226 symbol_table, it->second, keep_file_local, message_handler);
232 const bool keep_file_local,
246 log.
error() <<
"circular dependency in " <<
module.name << messaget::eom;
250 module.in_progress=true;
254 std::set<std::string> dependency_set;
256 module.file->language->dependencies(module.name, dependency_set);
258 for(std::set<std::string>::const_iterator it=
259 dependency_set.begin();
260 it!=dependency_set.end();
264 !typecheck_module(symbol_table, *it, keep_file_local, message_handler);
271 log.
status() <<
"Type-checking " <<
module.name << messaget::eom;
275 module.in_progress = !module.file->language->typecheck(
276 symbol_table, module.name, keep_file_local);
281 !module.file->language->typecheck(symbol_table, module.name);
287 module.type_checked=true;
288 module.in_progress=false;
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
bool parse(message_handlert &message_handler)
bool typecheck_module(symbol_table_baset &symbol_table, language_modulet &module, const bool keep_file_local, message_handlert &message_handler)
bool typecheck(symbol_table_baset &symbol_table, const bool keep_file_local, message_handlert &message_handler)
void show_parse(std::ostream &out)
bool interfaces(symbol_table_baset &symbol_table)
lazy_method_mapt lazy_method_map
bool generate_support_functions(symbol_table_baset &symbol_table)
bool final(symbol_table_baset &symbol_table)
language_filet(const std::string &filename)
~language_filet()
To avoid compiler errors, the complete definition of a pointed-to type must be visible at the point a...
void convert_lazy_method(const irep_idt &id, symbol_table_baset &symbol_table)
std::set< std::string > modulest
std::unique_ptr< languaget > language
virtual void modules_provided(std::set< std::string > &modules)
virtual bool can_keep_file_local()
Is it possible to call three-argument typecheck() on this object?
virtual bool parse(std::istream &instream, const std::string &path)=0
virtual void convert_lazy_method(const irep_idt &function_id, symbol_table_baset &symbol_table)
Requests this languaget should populate the body of method function_id in symbol_table.
Class that provides messages with a built-in verbosity 'level'.
mstreamt & status() const
The symbol table base class interface.
Abstract interface to support a programming language.