cprover
Loading...
Searching...
No Matches
jsil_parse_tree.h
Go to the documentation of this file.
1/*******************************************************************\
2
3Module: Jsil Language
4
5Author: Michael Tautschnig, tautschn@amazon.com
6
7\*******************************************************************/
8
11
12#ifndef CPROVER_JSIL_JSIL_PARSE_TREE_H
13#define CPROVER_JSIL_JSIL_PARSE_TREE_H
14
15#include <iosfwd>
16#include <list>
17
18#include <util/std_code.h>
19
20class symbolt;
21
23{
24public:
28
29 void add_declarator(const symbol_exprt &expr)
30 {
31 add(ID_declarator, expr);
32 }
33
34 const symbol_exprt &declarator() const
35 {
36 return static_cast<const symbol_exprt &>(find(ID_declarator));
37 }
38
40 {
41 return static_cast<symbol_exprt &>(add(ID_declarator));
42 }
43
45 const irep_idt &value,
46 const irep_idt &label)
47 {
49 add(ID_return).set(ID_label, label);
50 }
51
52 const irep_idt &returns_value() const
53 {
54 return find(ID_return).get(ID_value);
55 }
56
57 const irep_idt &returns_label() const
58 {
59 return find(ID_return).get(ID_label);
60 }
61
63 const irep_idt &value,
64 const irep_idt &label)
65 {
67 add(ID_throw).set(ID_label, label);
68 }
69
70 const irep_idt &throws_value() const
71 {
72 return find(ID_throw).get(ID_value);
73 }
74
75 const irep_idt &throws_label() const
76 {
77 return find(ID_throw).get(ID_label);
78 }
79
80 void add_value(const code_blockt &code)
81 {
82 add(ID_value, code);
83 }
84
85 const code_blockt &value() const
86 {
87 return static_cast<const code_blockt &>(find(ID_value));
88 }
89
91 {
92 return static_cast<code_blockt &>(add(ID_value));
93 }
94
95 symbolt to_symbol() const;
96
97 void output(std::ostream &) const;
98};
99
101{
102public:
103 typedef std::list<jsil_declarationt> itemst;
105
107 {
108 items.swap(other.items);
109 }
110
111 void clear()
112 {
113 items.clear();
114 }
115
116 void output(std::ostream &out) const;
117};
118
119#endif // CPROVER_JSIL_JSIL_PARSE_TREE_H
ait supplies three of the four components needed: an abstract interpreter (in this case handling func...
Definition ai.h:563
A codet representing sequential composition of program statements.
Definition std_code.h:130
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
Definition dstring.h:39
Base class for all expressions.
Definition expr.h:56
const irept & find(const irep_idt &name) const
Definition irep.cpp:101
void set(const irep_idt &name, const irep_idt &value)
Definition irep.h:420
irept & add(const irep_idt &name)
Definition irep.cpp:111
code_blockt & value()
void add_returns(const irep_idt &value, const irep_idt &label)
const code_blockt & value() const
const irep_idt & throws_label() const
const irep_idt & throws_value() const
const symbol_exprt & declarator() const
void output(std::ostream &) const
symbolt to_symbol() const
void add_throws(const irep_idt &value, const irep_idt &label)
void add_declarator(const symbol_exprt &expr)
const irep_idt & returns_label() const
void add_value(const code_blockt &code)
symbol_exprt & declarator()
const irep_idt & returns_value() const
void output(std::ostream &out) const
void swap(jsil_parse_treet &other)
std::list< jsil_declarationt > itemst
Expression to hold a symbol (variable)
Definition std_expr.h:113
Symbol table entry.
Definition symbol.h:28