ESBMC
Efficient SMT-based Context-Bounded Model Checker
Loading...
Searching...
No Matches
language.h
Go to the documentation of this file.
1#ifndef CPROVER_LANGUAGE_H
2#define CPROVER_LANGUAGE_H
3
4#include <cstdio>
5#include <set>
8
9enum class presentationt
10{
13};
14
16{
17public:
18 // parse file
19 virtual bool parse(const std::string &path) = 0;
20
21 // final adjustments, e.g., initialization and call to main()
22 virtual bool final(contextt &)
23 {
24 return false;
25 }
26
27 // type check a module in the currently parsed file
28 virtual bool typecheck(contextt &context, const std::string &module) = 0;
29
30 // language id
31 /* This is used by language_filest::final() to call languaget::final() only
32 * once for each concrete languaget in case of multiple source files. */
33 virtual std::string id() const
34 {
35 return "";
36 }
37
38 // show parse tree
39
40 virtual void show_parse(std::ostream &out) = 0;
41
42 // conversion of expressions
44 const exprt &expr,
45 std::string &code,
46 const namespacet &ns,
48 {
49 return from_expr(expr, code, ns, default_flags(target));
50 }
51
53 const typet &type,
54 std::string &code,
55 const namespacet &ns,
57 {
58 return from_type(type, code, ns, default_flags(target));
59 }
60
61 virtual unsigned default_flags(presentationt /* target */) const
62 {
63 return 0;
64 }
65
66 virtual languaget *new_language() const = 0;
67
68 virtual ~languaget() = default;
69
70protected:
71 virtual bool from_expr(
72 const exprt &expr,
73 std::string &code,
74 const namespacet &ns,
75 unsigned flags) = 0;
76
77 virtual bool from_type(
78 const typet &type,
79 std::string &code,
80 const namespacet &ns,
81 unsigned flags) = 0;
82};
83
84#endif
Definition context.h:57
Definition expr.h:34
Definition language.h:16
bool from_type(const typet &type, std::string &code, const namespacet &ns, presentationt target=presentationt::HUMAN)
Definition language.h:52
bool from_expr(const exprt &expr, std::string &code, const namespacet &ns, presentationt target=presentationt::HUMAN)
Definition language.h:43
virtual bool typecheck(contextt &context, const std::string &module)=0
virtual bool from_type(const typet &type, std::string &code, const namespacet &ns, unsigned flags)=0
virtual bool from_expr(const exprt &expr, std::string &code, const namespacet &ns, unsigned flags)=0
virtual std::string id() const
Definition language.h:33
virtual void show_parse(std::ostream &out)=0
virtual ~languaget()=default
virtual bool parse(const std::string &path)=0
virtual languaget * new_language() const =0
virtual unsigned default_flags(presentationt) const
Definition language.h:61
Definition module.h:60
Definition namespace.h:10
Definition type.h:9
presentationt
Definition language.h:10
@ HUMAN
Definition language.h:11
@ WITNESS
Definition language.h:12
Definition path.py:1