@@ -88,31 +88,36 @@ const irept &get_nil_irep();
88
88
// / CPROVER. `irept` provides a single, unified representation for all of
89
89
// / these, allowing structure sharing and reference counting of data. As
90
90
// / such `irept` is the basic unit of data in CPROVER. Each `irept`
91
- // / contains[^1] a basic unit of data (of type `dt`) which contains four
92
- // / things:
91
+ // / contains (or references, if reference counted data sharing is enabled, as
92
+ // / it is by default - see the `SHARING` macro) a basic unit of data (of type
93
+ // / `dt`) which contains four things:
93
94
// /
94
- // / * `data`: A string[^2], which is returned when the `id()` function is
95
- // / used.
95
+ // / * `data`: A string, which is returned when the `id()` function is used.
96
+ // / (Unless `USE_STD_STRING` is set, this is actually a `dstring` and thus
97
+ // / an integer which is a reference into a string table.)
96
98
// /
97
99
// / * `named_sub`: A map from `irep_namet` (a string) to `irept`. This
98
100
// / is used for named children, i.e. subexpressions, parameters, etc.
99
101
// /
100
102
// / * `comments`: Another map from `irep_namet` to `irept` which is used
101
- // / for annotations and other ‘non-semantic’ information
103
+ // / for annotations and other ‘non-semantic’ information. Note that this
104
+ // / map is ignore by the default `operator==`.
102
105
// /
103
106
// / * `sub`: A vector of `irept` which is used to store ordered but
104
107
// / unnamed children.
105
108
// /
106
- // / The `irept::pretty` function outputs the contents of an `irept` directly
107
- // / and can be used to understand and debug problems with `irept`s.
109
+ // / The `irept::pretty` function outputs the explicit tree structure of
110
+ // / an `irept` and can be used to understand and debug problems with
111
+ // / `irept`s.
108
112
// /
109
- // / On their own `irept`s do not “ mean” anything; they are effectively
113
+ // / On their own `irept`s do not " mean" anything; they are effectively
110
114
// / generic tree nodes. Their interpretation depends on the contents of
111
- // / result of the `id` function (the `data`) field. `util/irep_ids.txt`
112
- // / contains the complete list of `id` values. During the build process it
113
- // / is used to generate `util/irep_ids.h` which gives constants for each id
114
- // / (named `ID_`). These can then be used to identify what kind of data
115
- // / `irept` stores and thus what can be done with it.
115
+ // / result of the `id` function (the `data`) field. `util/irep_ids.def`
116
+ // / contains a list of `id` values. During the build process it is used
117
+ // / to generate `util/irep_ids.h` which gives constants for each id
118
+ // / (named `ID_`). You can also make `irep_id`s which do not come from
119
+ // / `util/irep_ids.def`. An `irep_id`can then be used to identify what
120
+ // / kind of data `irept` stores and thus what can be done with it.
116
121
// /
117
122
// / To simplify this process, there are a variety of classes that inherit
118
123
// / from `irept`, roughly corresponding to the ids listed (i.e. `ID_or`
@@ -130,29 +135,23 @@ const irept &get_nil_irep();
130
135
// / with the architecture of the code.
131
136
// /
132
137
// / Many of the key descendant of `exprt` are declared in `std_expr.h`. All
133
- // / expressions have a named subfield / annotation which gives the type of
134
- // / the expression (slightly simplified from C/C++ as `unsignedbv_typet`,
135
- // / `signedbv_typet`, `floatbv_typet`, etc.). All type conversions are
136
- // / explicit with an expression with `id() == ID_typecast` and an ‘interface
137
- // / class’ named `typecast_exprt`. One key descendant of `exprt` is
138
- // / `symbol_exprt` which creates `irept` instances with the id of “symbol”.
139
- // / These are used to represent variables; the name of which can be found
140
- // / using the `get_identifier` accessor function.
138
+ // / expressions have a named subexpresion with ID `type`, which gives the
139
+ // / type of the expression (slightly simplified from C/C++ as
140
+ // / `unsignedbv_typet`, ` signedbv_typet`, `floatbv_typet`, etc.). All type
141
+ // / conversions are explicit with an expression with `id() == ID_typecast`
142
+ // / and a `typecast_exprt`. One key descendant of `exprt` is `symbol_exprt`
143
+ // / which creates `irept` instances with the id of “symbol”. These are used
144
+ // / to represent variables; the name of which can be found using the
145
+ // / `get_identifier` accessor function.
141
146
// /
142
147
// / `codet` inherits from `exprt` and is defined in `std_code.h`. It
143
- // / represents executable code; statements in C rather than expressions. In
144
- // / the front-end there are versions of these that hold whole code blocks,
145
- // / but in goto-programs these have been flattened so that each `irept`
146
- // / represents one sequence point (almost one line of code / one
147
- // / semi-colon). The most common descendants of `codet` are `code_assignt`
148
- // / so a common pattern is to cast the `codet` to an assignment and then
149
- // / recurse on the expression on either side.
150
- // /
151
- // / [^1]: Or references, if reference counted data sharing is enabled. It is
152
- // / enabled by default; see the `SHARING` macro.
153
- // /
154
- // / [^2]: Unless `USE_STD_STRING` is set, this is actually
155
- // / a `dstring` and thus an integer which is a reference into a string table
148
+ // / represents executable code; statements in a C-like language rather than
149
+ // / expressions. In the front-end there are versions of these that hold
150
+ // / whole code blocks, but in goto-programs these have been flattened so
151
+ // / that each `irept` represents one sequence point (almost one line of
152
+ // / code / one semi-colon). The most common descendant of `codet` is
153
+ // / `code_assignt` so a common pattern is to cast the `codet` to an
154
+ // / assignment and then recurse on the expression on either side.
156
155
class irept
157
156
{
158
157
public:
0 commit comments