CBMC
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
13#include <util/symbol_table.h>
14
15#include <json/json_parser.h>
16#include <linking/linking.h>
17
18#include "json_symbol_table.h"
19
26 std::istream &instream,
27 const std::string &path,
28 message_handlert &message_handler)
29{
30 return parse_json(instream, path, message_handler, parsed_json_file);
31}
32
39 symbol_table_baset &symbol_table,
40 const std::string &module,
41 message_handlert &message_handler)
42{
43 (void)module; // unused parameter
44
45 symbol_tablet new_symbol_table;
46
47 try
48 {
50 return linking(symbol_table, new_symbol_table, message_handler);
51 }
52 catch(const std::string &str)
53 {
54 messaget log(message_handler);
55 log.error() << "typecheck: " << str << messaget::eom;
56 return true;
57 }
58}
59
65 std::ostream &out,
66 message_handlert &message_handler)
67{
68 (void)message_handler;
70}
ait supplies three of the four components needed: an abstract interpreter (in this case handling func...
Definition ai.h:562
bool parse(std::istream &instream, const std::string &path, message_handlert &message_handler) override
Parse a goto program in json form.
bool typecheck(symbol_table_baset &symbol_table, const std::string &module, message_handlert &message_handler) override
Typecheck a goto program in json form.
void show_parse(std::ostream &out, message_handlert &) override
Output the result of the parsed json file to the output stream passed as a parameter to this function...
void output(std::ostream &out) const
Definition json.h:90
Class that provides messages with a built-in verbosity 'level'.
Definition message.h:154
static eomt eom
Definition message.h:289
The symbol table base class interface.
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_table_baset &symbol_table)
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...
Definition linking.cpp:1130
ANSI-C Linking.
double log(double x)
Definition math.c:2776
Author: Diffblue Ltd.