CBMC
statement_list_language.h
Go to the documentation of this file.
1 /*******************************************************************\
2 
3 Module: Statement List Language Interface
4 
5 Author: Matthias Weiss, matthias.weiss@diffblue.com
6 
7 \*******************************************************************/
8 
11 
12 #ifndef CPROVER_STATEMENT_LIST_STATEMENT_LIST_LANGUAGE_H
13 #define CPROVER_STATEMENT_LIST_STATEMENT_LIST_LANGUAGE_H
14 
16 #include <langapi/language.h>
17 
19 
24 {
25 public:
31  const optionst &options,
32  message_handlert &message_handler) override;
33 
40  bool parse(
41  std::istream &instream,
42  const std::string &path,
43  message_handlert &message_handler) override;
44 
47  symbol_table_baset &symbol_table,
48  message_handlert &) override;
49 
59  bool typecheck(
60  symbol_table_baset &symbol_table,
61  const std::string &module,
62  message_handlert &message_handler,
63  const bool keep_file_local) override;
64 
65  bool typecheck(
66  symbol_table_baset &symbol_table,
67  const std::string &module,
68  message_handlert &) override;
69 
70  bool can_keep_file_local() override;
71 
73  void show_parse(std::ostream &out, message_handlert &) override;
74 
75  // Constructor and destructor.
76  ~statement_list_languaget() override;
78 
84  bool from_expr(const exprt &expr, std::string &code, const namespacet &ns)
85  override;
86 
92  bool from_type(const typet &type, std::string &code, const namespacet &ns)
93  override;
94 
100  bool type_to_name(const typet &type, std::string &name, const namespacet &ns)
101  override;
102 
110  bool to_expr(
111  const std::string &code,
112  const std::string &module,
113  exprt &expr,
114  const namespacet &ns,
115  message_handlert &message_handler) override;
116 
117  std::unique_ptr<languaget> new_language() override;
118 
119  // ID, description, extensions, modules.
120  std::string id() const override;
121  std::string description() const override;
122  std::set<std::string> extensions() const override;
123  void modules_provided(std::set<std::string> &modules) override;
124 
125 private:
127  std::string parse_path;
129 };
130 
131 std::unique_ptr<languaget> new_statement_list_language();
132 
133 #endif // CPROVER_STATEMENT_LIST_STATEMENT_LIST_LANGUAGE_H
Base class for all expressions.
Definition: expr.h:56
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
Definition: namespace.h:94
Implements the language interface for the Statement List language.
void modules_provided(std::set< std::string > &modules) override
object_factory_parameterst params
void set_language_options(const optionst &options, message_handlert &message_handler) override
Sets language specific options.
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.
std::set< std::string > extensions() const override
void show_parse(std::ostream &out, message_handlert &) override
Prints the parse tree to the given output stream.
bool typecheck(symbol_table_baset &symbol_table, const std::string &module, message_handlert &message_handler, const bool keep_file_local) override
Converts the current parse tree into a symbol table.
std::unique_ptr< languaget > new_language() override
std::string id() const override
bool generate_support_functions(symbol_table_baset &symbol_table, message_handlert &) override
Currently unused.
bool from_type(const typet &type, std::string &code, const namespacet &ns) override
Formats the given type in a language-specific way.
statement_list_parse_treet parse_tree
bool from_expr(const exprt &expr, std::string &code, const namespacet &ns) override
Formats the given expression in a language-specific way.
std::string description() const override
bool can_keep_file_local() override
Is it possible to call three-argument typecheck() on this object?
bool type_to_name(const typet &type, std::string &name, const namespacet &ns) override
Encodes the given type in a language-specific way.
bool parse(std::istream &instream, const std::string &path, message_handlert &message_handler) override
Parses input given by instream and saves this result to this instance's parse tree.
Intermediate representation of a parsed Statement List file before converting it into a goto program.
The symbol table base class interface.
The type of an expression, extends irept.
Definition: type.h:29
Abstract interface to support a programming language.
std::unique_ptr< languaget > new_statement_list_language()
Statement List Language Parse Tree.