cprover
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:
29  void set_language_options(const optionst &options) override;
30 
36  bool parse(std::istream &instream, const std::string &path) override;
37 
39  bool generate_support_functions(symbol_tablet &symbol_table) override;
40 
49  bool typecheck(
50  symbol_tablet &symbol_table,
51  const std::string &module,
52  const bool keep_file_local) override;
53 
54  bool
55  typecheck(symbol_tablet &symbol_table, const std::string &module) override;
56 
57  bool can_keep_file_local() override;
58 
60  void show_parse(std::ostream &out) override;
61 
62  // Constructor and destructor.
63  ~statement_list_languaget() override;
65 
71  bool from_expr(const exprt &expr, std::string &code, const namespacet &ns)
72  override;
73 
79  bool from_type(const typet &type, std::string &code, const namespacet &ns)
80  override;
81 
87  bool type_to_name(const typet &type, std::string &name, const namespacet &ns)
88  override;
89 
96  bool to_expr(
97  const std::string &code,
98  const std::string &module,
99  exprt &expr,
100  const namespacet &ns) override;
101 
102  std::unique_ptr<languaget> new_language() override;
103 
104  // ID, description, extensions, modules.
105  std::string id() const override;
106  std::string description() const override;
107  std::set<std::string> extensions() const override;
108  void modules_provided(std::set<std::string> &modules) override;
109 
110 private:
112  std::string parse_path;
114 };
115 
116 std::unique_ptr<languaget> new_statement_list_language();
117 
118 #endif // CPROVER_STATEMENT_LIST_STATEMENT_LIST_LANGUAGE_H
Base class for all expressions.
Definition: expr.h:54
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
Definition: namespace.h:91
Implements the language interface for the Statement List language.
bool to_expr(const std::string &code, const std::string &module, exprt &expr, const namespacet &ns) override
Parses the given string into an expression.
void modules_provided(std::set< std::string > &modules) override
void show_parse(std::ostream &out) override
Prints the parse tree to the given output stream.
object_factory_parameterst params
std::set< std::string > extensions() const override
std::unique_ptr< languaget > new_language() override
bool generate_support_functions(symbol_tablet &symbol_table) override
Currently unused.
std::string id() const override
bool from_type(const typet &type, std::string &code, const namespacet &ns) override
Formats the given type in a language-specific way.
bool parse(std::istream &instream, const std::string &path) override
Parses input given by instream and saves this result to this instance's parse tree.
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 typecheck(symbol_tablet &symbol_table, const std::string &module, const bool keep_file_local) override
Converts the current parse tree into a symbol table.
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.
void set_language_options(const optionst &options) override
Sets language specific options.
Intermediate representation of a parsed Statement List file before converting it into a goto program.
The symbol table.
Definition: symbol_table.h:14
The type of an expression, extends irept.
Definition: type.h:28
Abstract interface to support a programming language.
std::unique_ptr< languaget > new_statement_list_language()
Statement List Language Parse Tree.