cprover
language.cpp
Go to the documentation of this file.
1 /*******************************************************************\
2 
3 Module: Abstract interface to support a programming language
4 
5 Author: Daniel Kroening, kroening@kroening.com
6 
7 \*******************************************************************/
8 
11 
12 #include "language.h"
13 
14 #include <util/expr.h>
15 #include <util/symbol.h>
16 #include <util/symbol_table.h>
17 #include <util/prefix.h>
18 #include <util/cprover_prefix.h>
19 #include <util/std_types.h>
20 
22 {
23  return false;
24 }
25 
27 {
28  return false;
29 }
30 
32  const std::string &,
33  std::set<std::string> &)
34 {
35 }
36 
38  const exprt &expr,
39  std::string &code,
40  const namespacet &)
41 {
42  code=expr.pretty();
43  return false;
44 }
45 
47  const typet &type,
48  std::string &code,
49  const namespacet &)
50 {
51  code=type.pretty();
52  return false;
53 }
54 
56  const typet &type,
57  std::string &name,
58  const namespacet &)
59 {
60  // probably ansi-c/type2name could be used as better fallback if moved to
61  // util/
62  name=type.pretty();
63  return false;
64 }
Base class for all expressions.
Definition: expr.h:54
std::string pretty(unsigned indent=0, unsigned max_indent=0) const
Definition: irep.cpp:492
virtual bool final(symbol_table_baset &symbol_table)
Final adjustments, e.g.
Definition: language.cpp:21
virtual void dependencies(const std::string &module, std::set< std::string > &modules)
Definition: language.cpp:31
virtual bool from_type(const typet &type, std::string &code, const namespacet &ns)
Formats the given type in a language-specific way.
Definition: language.cpp:46
virtual bool type_to_name(const typet &type, std::string &name, const namespacet &ns)
Encodes the given type in a language-specific way.
Definition: language.cpp:55
virtual bool from_expr(const exprt &expr, std::string &code, const namespacet &ns)
Formats the given expression in a language-specific way.
Definition: language.cpp:37
virtual bool interfaces(symbol_tablet &symbol_table)
Definition: language.cpp:26
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
Definition: namespace.h:92
The symbol table base class interface.
The symbol table.
Definition: symbol_table.h:20
The type of an expression, extends irept.
Definition: type.h:28
Abstract interface to support a programming language.
Pre-defined types.
Symbol table entry.
Author: Diffblue Ltd.