cprover
Loading...
Searching...
No Matches
json_symtab_language.cpp
Go to the documentation of this file.
1/*******************************************************************\
2
3Module: JSON symbol table language. Accepts a JSON format symbol
4 table that has been produced out-of-process, e.g. by using
5 a compiler's front-end.
6
7Author: Chris Smowton, chris.smowton@diffblue.com
8
9\*******************************************************************/
10
12#include "json_symbol_table.h"
13#include <json/json_parser.h>
14
15#include <linking/linking.h>
16
22 std::istream &instream,
23 const std::string &path)
24{
25 return parse_json(instream, path, get_message_handler(), parsed_json_file);
26}
27
33 symbol_tablet &symbol_table,
34 const std::string &module)
35{
36 (void)module; // unused parameter
37
38 symbol_tablet new_symbol_table;
39
40 try
41 {
43 return linking(symbol_table, new_symbol_table, get_message_handler());
44 }
45 catch(const std::string &str)
46 {
47 error() << "typecheck: " << str << eom;
48 return true;
49 }
50}
51
55void json_symtab_languaget::show_parse(std::ostream &out)
56{
58}
void show_parse(std::ostream &out) override
Output the result of the parsed json file to the output stream passed as a parameter to this function...
bool typecheck(symbol_tablet &symbol_table, const std::string &module) override
Typecheck a goto program in json form.
bool parse(std::istream &instream, const std::string &path) override
Parse a goto program in json form.
void output(std::ostream &out) const
Definition json.h:90
mstreamt & error() const
Definition message.h:399
message_handlert & get_message_handler()
Definition message.h:184
static eomt eom
Definition message.h:297
The symbol table.
bool parse_json(std::istream &in, const std::string &filename, message_handlert &message_handler, jsont &dest)
void symbol_table_from_json(const jsont &in, symbol_tablet &symbol_table)
bool linking(symbol_tablet &dest_symbol_table, const symbol_tablet &new_symbol_table, message_handlert &message_handler)
Merges the symbol table new_symbol_table into dest_symbol_table, renaming symbols from new_symbol_tab...
Definition linking.cpp:1470
ANSI-C Linking.