libTriton version 1.0 build 1592
Loading...
Searching...
No Matches
astPythonRepresentation.cpp
Go to the documentation of this file.
1
2/*
3** Copyright (C) - Triton
4**
5** This program is under the terms of the Apache License 2.0.
6*/
7
12
13
14
15namespace triton {
16 namespace ast {
17 namespace representations {
18
21
22
23 /* Representation dispatcher from an abstract node */
24 std::ostream& AstPythonRepresentation::print(std::ostream& stream, triton::ast::AbstractNode* node) {
25 switch (node->getType()) {
26 case ARRAY_NODE: return this->print(stream, reinterpret_cast<triton::ast::ArrayNode*>(node)); break;
27 case ASSERT_NODE: return this->print(stream, reinterpret_cast<triton::ast::AssertNode*>(node)); break;
28 case BSWAP_NODE: return this->print(stream, reinterpret_cast<triton::ast::BswapNode*>(node)); break;
29 case BVADD_NODE: return this->print(stream, reinterpret_cast<triton::ast::BvaddNode*>(node)); break;
30 case BVAND_NODE: return this->print(stream, reinterpret_cast<triton::ast::BvandNode*>(node)); break;
31 case BVASHR_NODE: return this->print(stream, reinterpret_cast<triton::ast::BvashrNode*>(node)); break;
32 case BVLSHR_NODE: return this->print(stream, reinterpret_cast<triton::ast::BvlshrNode*>(node)); break;
33 case BVMUL_NODE: return this->print(stream, reinterpret_cast<triton::ast::BvmulNode*>(node)); break;
34 case BVNAND_NODE: return this->print(stream, reinterpret_cast<triton::ast::BvnandNode*>(node)); break;
35 case BVNEG_NODE: return this->print(stream, reinterpret_cast<triton::ast::BvnegNode*>(node)); break;
36 case BVNOR_NODE: return this->print(stream, reinterpret_cast<triton::ast::BvnorNode*>(node)); break;
37 case BVNOT_NODE: return this->print(stream, reinterpret_cast<triton::ast::BvnotNode*>(node)); break;
38 case BVOR_NODE: return this->print(stream, reinterpret_cast<triton::ast::BvorNode*>(node)); break;
39 case BVROL_NODE: return this->print(stream, reinterpret_cast<triton::ast::BvrolNode*>(node)); break;
40 case BVROR_NODE: return this->print(stream, reinterpret_cast<triton::ast::BvrorNode*>(node)); break;
41 case BVSDIV_NODE: return this->print(stream, reinterpret_cast<triton::ast::BvsdivNode*>(node)); break;
42 case BVSGE_NODE: return this->print(stream, reinterpret_cast<triton::ast::BvsgeNode*>(node)); break;
43 case BVSGT_NODE: return this->print(stream, reinterpret_cast<triton::ast::BvsgtNode*>(node)); break;
44 case BVSHL_NODE: return this->print(stream, reinterpret_cast<triton::ast::BvshlNode*>(node)); break;
45 case BVSLE_NODE: return this->print(stream, reinterpret_cast<triton::ast::BvsleNode*>(node)); break;
46 case BVSLT_NODE: return this->print(stream, reinterpret_cast<triton::ast::BvsltNode*>(node)); break;
47 case BVSMOD_NODE: return this->print(stream, reinterpret_cast<triton::ast::BvsmodNode*>(node)); break;
48 case BVSREM_NODE: return this->print(stream, reinterpret_cast<triton::ast::BvsremNode*>(node)); break;
49 case BVSUB_NODE: return this->print(stream, reinterpret_cast<triton::ast::BvsubNode*>(node)); break;
50 case BVUDIV_NODE: return this->print(stream, reinterpret_cast<triton::ast::BvudivNode*>(node)); break;
51 case BVUGE_NODE: return this->print(stream, reinterpret_cast<triton::ast::BvugeNode*>(node)); break;
52 case BVUGT_NODE: return this->print(stream, reinterpret_cast<triton::ast::BvugtNode*>(node)); break;
53 case BVULE_NODE: return this->print(stream, reinterpret_cast<triton::ast::BvuleNode*>(node)); break;
54 case BVULT_NODE: return this->print(stream, reinterpret_cast<triton::ast::BvultNode*>(node)); break;
55 case BVUREM_NODE: return this->print(stream, reinterpret_cast<triton::ast::BvuremNode*>(node)); break;
56 case BVXNOR_NODE: return this->print(stream, reinterpret_cast<triton::ast::BvxnorNode*>(node)); break;
57 case BVXOR_NODE: return this->print(stream, reinterpret_cast<triton::ast::BvxorNode*>(node)); break;
58 case BV_NODE: return this->print(stream, reinterpret_cast<triton::ast::BvNode*>(node)); break;
59 case COMPOUND_NODE: return this->print(stream, reinterpret_cast<triton::ast::CompoundNode*>(node)); break;
60 case CONCAT_NODE: return this->print(stream, reinterpret_cast<triton::ast::ConcatNode*>(node)); break;
61 case DECLARE_NODE: return this->print(stream, reinterpret_cast<triton::ast::DeclareNode*>(node)); break;
62 case DISTINCT_NODE: return this->print(stream, reinterpret_cast<triton::ast::DistinctNode*>(node)); break;
63 case EQUAL_NODE: return this->print(stream, reinterpret_cast<triton::ast::EqualNode*>(node)); break;
64 case EXTRACT_NODE: return this->print(stream, reinterpret_cast<triton::ast::ExtractNode*>(node)); break;
65 case FORALL_NODE: return this->print(stream, reinterpret_cast<triton::ast::ForallNode*>(node)); break;
66 case IFF_NODE: return this->print(stream, reinterpret_cast<triton::ast::IffNode*>(node)); break;
67 case INTEGER_NODE: return this->print(stream, reinterpret_cast<triton::ast::IntegerNode*>(node)); break;
68 case ITE_NODE: return this->print(stream, reinterpret_cast<triton::ast::IteNode*>(node)); break;
69 case LAND_NODE: return this->print(stream, reinterpret_cast<triton::ast::LandNode*>(node)); break;
70 case LET_NODE: return this->print(stream, reinterpret_cast<triton::ast::LetNode*>(node)); break;
71 case LNOT_NODE: return this->print(stream, reinterpret_cast<triton::ast::LnotNode*>(node)); break;
72 case LOR_NODE: return this->print(stream, reinterpret_cast<triton::ast::LorNode*>(node)); break;
73 case LXOR_NODE: return this->print(stream, reinterpret_cast<triton::ast::LxorNode*>(node)); break;
74 case REFERENCE_NODE: return this->print(stream, reinterpret_cast<triton::ast::ReferenceNode*>(node)); break;
75 case SELECT_NODE: return this->print(stream, reinterpret_cast<triton::ast::SelectNode*>(node)); break;
76 case STORE_NODE: return this->print(stream, reinterpret_cast<triton::ast::StoreNode*>(node)); break;
77 case STRING_NODE: return this->print(stream, reinterpret_cast<triton::ast::StringNode*>(node)); break;
78 case SX_NODE: return this->print(stream, reinterpret_cast<triton::ast::SxNode*>(node)); break;
79 case VARIABLE_NODE: return this->print(stream, reinterpret_cast<triton::ast::VariableNode*>(node)); break;
80 case ZX_NODE: return this->print(stream, reinterpret_cast<triton::ast::ZxNode*>(node)); break;
81 default:
82 throw triton::exceptions::AstRepresentation("AstPythonRepresentation::print(AbstractNode): Invalid kind node.");
83 }
84 return stream;
85 }
86
87
88 /* array representation */
89 std::ostream& AstPythonRepresentation::print(std::ostream& stream, triton::ast::ArrayNode* node) {
90 stream << "Memory";
91 return stream;
92 }
93
94
95 /* assert representation */
96 std::ostream& AstPythonRepresentation::print(std::ostream& stream, triton::ast::AssertNode* node) {
97 stream << "assert(" << node->getChildren()[0] << ")";
98 return stream;
99 }
100
101
102 /* bswap representation */
103 std::ostream& AstPythonRepresentation::print(std::ostream& stream, triton::ast::BswapNode* node) {
104 stream << "bswap(" << node->getChildren()[0] << ", " << node->getBitvectorSize() << ")";
105 return stream;
106 }
107
108
109 /* bvadd representation */
110 std::ostream& AstPythonRepresentation::print(std::ostream& stream, triton::ast::BvaddNode* node) {
111 stream << "((" << node->getChildren()[0] << " + " << node->getChildren()[1] << ") & 0x" << std::hex << node->getBitvectorMask() << std::dec << ")";
112 return stream;
113 }
114
115
116 /* bvand representation */
117 std::ostream& AstPythonRepresentation::print(std::ostream& stream, triton::ast::BvandNode* node) {
118 stream << "(" << node->getChildren()[0] << " & " << node->getChildren()[1] << ")";
119 return stream;
120 }
121
122
123 /* bvashr representation */
124 std::ostream& AstPythonRepresentation::print(std::ostream& stream, triton::ast::BvashrNode* node) {
125 stream << "(" << node->getChildren()[0] << " >> " << node->getChildren()[1] << ")";
126 return stream;
127 }
128
129
130 /* bvlshr representation */
131 std::ostream& AstPythonRepresentation::print(std::ostream& stream, triton::ast::BvlshrNode* node) {
132 stream << "(" << node->getChildren()[0] << " >> " << node->getChildren()[1] << ")";
133 return stream;
134 }
135
136
137 /* bvmul representation */
138 std::ostream& AstPythonRepresentation::print(std::ostream& stream, triton::ast::BvmulNode* node) {
139 stream << "((" << node->getChildren()[0] << " * " << node->getChildren()[1] << ") & 0x" << std::hex << node->getBitvectorMask() << std::dec << ")";
140 return stream;
141 }
142
143
144 /* bvnand representation */
145 std::ostream& AstPythonRepresentation::print(std::ostream& stream, triton::ast::BvnandNode* node) {
146 stream << "(~(" << node->getChildren()[0] << " & " << node->getChildren()[1] << ") & 0x" << std::hex << node->getBitvectorMask() << std::dec << ")";
147 return stream;
148 }
149
150
151 /* bvneg representation */
152 std::ostream& AstPythonRepresentation::print(std::ostream& stream, triton::ast::BvnegNode* node) {
153 stream << "(-(" << node->getChildren()[0] << ") & 0x" << std::hex << node->getBitvectorMask() << std::dec << ")";
154 return stream;
155 }
156
157
158 /* bvnor representation */
159 std::ostream& AstPythonRepresentation::print(std::ostream& stream, triton::ast::BvnorNode* node) {
160 stream << "(~(" << node->getChildren()[0] << " | " << node->getChildren()[1] << ") & 0x" << std::hex << node->getBitvectorMask() << std::dec << ")";
161 return stream;
162 }
163
164
165 /* bvnot representation */
166 std::ostream& AstPythonRepresentation::print(std::ostream& stream, triton::ast::BvnotNode* node) {
167 stream << "(~(" << node->getChildren()[0] << ") & 0x" << std::hex << node->getBitvectorMask() << std::dec << ")";
168 return stream;
169 }
170
171
172 /* bvor representation */
173 std::ostream& AstPythonRepresentation::print(std::ostream& stream, triton::ast::BvorNode* node) {
174 stream << "(" << node->getChildren()[0] << " | " << node->getChildren()[1] << ")";
175 return stream;
176 }
177
178
179 /* bvrol representation */
180 std::ostream& AstPythonRepresentation::print(std::ostream& stream, triton::ast::BvrolNode* node) {
181 stream << "rol(" << node->getChildren()[0] << ", " << node->getChildren()[1] << ", " << node->getBitvectorSize() << ")";
182 return stream;
183 }
184
185
186 /* bvror representation */
187 std::ostream& AstPythonRepresentation::print(std::ostream& stream, triton::ast::BvrorNode* node) {
188 stream << "ror(" << node->getChildren()[0] << ", " << node->getChildren()[1] << ", " << node->getBitvectorSize() << ")";
189 return stream;
190 }
191
192
193 /* bvsdiv representation */
194 std::ostream& AstPythonRepresentation::print(std::ostream& stream, triton::ast::BvsdivNode* node) {
195 stream << "(" << node->getChildren()[0] << " / " << node->getChildren()[1] << ")";
196 return stream;
197 }
198
199
200 /* bvsge representation */
201 std::ostream& AstPythonRepresentation::print(std::ostream& stream, triton::ast::BvsgeNode* node) {
202 stream << "(" << node->getChildren()[0] << " >= " << node->getChildren()[1] << ")";
203 return stream;
204 }
205
206
207 /* bvsgt representation */
208 std::ostream& AstPythonRepresentation::print(std::ostream& stream, triton::ast::BvsgtNode* node) {
209 stream << "(" << node->getChildren()[0] << " > " << node->getChildren()[1] << ")";
210 return stream;
211 }
212
213
214 /* bvshl representation */
215 std::ostream& AstPythonRepresentation::print(std::ostream& stream, triton::ast::BvshlNode* node) {
216 stream << "((" << node->getChildren()[0] << " << " << node->getChildren()[1] << ") & 0x" << std::hex << node->getBitvectorMask() << std::dec << ")";
217 return stream;
218 }
219
220
221 /* bvsle representation */
222 std::ostream& AstPythonRepresentation::print(std::ostream& stream, triton::ast::BvsleNode* node) {
223 stream << "(" << node->getChildren()[0] << " <= " << node->getChildren()[1] << ")";
224 return stream;
225 }
226
227
228 /* bvslt representation */
229 std::ostream& AstPythonRepresentation::print(std::ostream& stream, triton::ast::BvsltNode* node) {
230 stream << "(" << node->getChildren()[0] << " < " << node->getChildren()[1] << ")";
231 return stream;
232 }
233
234
235 /* bvsmod representation */
236 std::ostream& AstPythonRepresentation::print(std::ostream& stream, triton::ast::BvsmodNode* node) {
237 stream << "(" << node->getChildren()[0] << " % " << node->getChildren()[1] << ")";
238 return stream;
239 }
240
241
242 /* bvsrem representation */
243 std::ostream& AstPythonRepresentation::print(std::ostream& stream, triton::ast::BvsremNode* node) {
244 stream << "(" << node->getChildren()[0] << " % " << node->getChildren()[1] << ")";
245 return stream;
246 }
247
248
249 /* bvsub representation */
250 std::ostream& AstPythonRepresentation::print(std::ostream& stream, triton::ast::BvsubNode* node) {
251 stream << "((" << node->getChildren()[0] << " - " << node->getChildren()[1] << ") & 0x" << std::hex << node->getBitvectorMask() << std::dec << ")";
252 return stream;
253 }
254
255
256 /* bvudiv representation */
257 std::ostream& AstPythonRepresentation::print(std::ostream& stream, triton::ast::BvudivNode* node) {
258 stream << "(" << node->getChildren()[0] << " / " << node->getChildren()[1] << ")";
259 return stream;
260 }
261
262
263 /* bvuge representation */
264 std::ostream& AstPythonRepresentation::print(std::ostream& stream, triton::ast::BvugeNode* node) {
265 stream << "(" << node->getChildren()[0] << " >= " << node->getChildren()[1] << ")";
266 return stream;
267 }
268
269
270 /* bvugt representation */
271 std::ostream& AstPythonRepresentation::print(std::ostream& stream, triton::ast::BvugtNode* node) {
272 stream << "(" << node->getChildren()[0] << " > " << node->getChildren()[1] << ")";
273 return stream;
274 }
275
276
277 /* bvule representation */
278 std::ostream& AstPythonRepresentation::print(std::ostream& stream, triton::ast::BvuleNode* node) {
279 stream << "(" << node->getChildren()[0] << " <= " << node->getChildren()[1] << ")";
280 return stream;
281 }
282
283
284 /* bvult representation */
285 std::ostream& AstPythonRepresentation::print(std::ostream& stream, triton::ast::BvultNode* node) {
286 stream << "(" << node->getChildren()[0] << " < " << node->getChildren()[1] << ")";
287 return stream;
288 }
289
290
291 /* bvurem representation */
292 std::ostream& AstPythonRepresentation::print(std::ostream& stream, triton::ast::BvuremNode* node) {
293 stream << "(" << node->getChildren()[0] << " % " << node->getChildren()[1] << ")";
294 return stream;
295 }
296
297
298 /* bvxnor representation */
299 std::ostream& AstPythonRepresentation::print(std::ostream& stream, triton::ast::BvxnorNode* node) {
300 stream << "(~(" << node->getChildren()[0] << " ^ " << node->getChildren()[1] << ") & 0x" << std::hex << node->getBitvectorMask() << std::dec << ")";
301 return stream;
302 }
303
304
305 /* bvxor representation */
306 std::ostream& AstPythonRepresentation::print(std::ostream& stream, triton::ast::BvxorNode* node) {
307 stream << "(" << node->getChildren()[0] << " ^ " << node->getChildren()[1] << ")";
308 return stream;
309 }
310
311
312 /* bv representation */
313 std::ostream& AstPythonRepresentation::print(std::ostream& stream, triton::ast::BvNode* node) {
314 stream << node->getChildren()[0];
315 return stream;
316 }
317
318
319 /* compound representation */
320 std::ostream& AstPythonRepresentation::print(std::ostream& stream, triton::ast::CompoundNode* node) {
321 std::vector<triton::ast::SharedAbstractNode> children = node->getChildren();
322 triton::usize size = children.size();
323
324 for (triton::usize index = 0; index < size-1; index++)
325 stream << children[index] << std::endl;
326 stream << children[size-1];
327
328 return stream;
329 }
330
331
332 /* concat representation */
333 std::ostream& AstPythonRepresentation::print(std::ostream& stream, triton::ast::ConcatNode* node) {
334 triton::usize size = node->getChildren().size();
335
336 for (triton::usize index = 0; index < size; index++)
337 stream << "(";
338
339 for (triton::usize index = 0; index < size-1; index++)
340 stream << node->getChildren()[index] << ") << " << node->getChildren()[index+1]->getBitvectorSize() << " | ";
341
342 stream << node->getChildren()[size-1] << ")";
343 return stream;
344 }
345
346
347 /* declare representation */
348 std::ostream& AstPythonRepresentation::print(std::ostream& stream, triton::ast::DeclareNode* node) {
349 if (node->getChildren()[0]->getType() == VARIABLE_NODE) {
350 const triton::engines::symbolic::SharedSymbolicVariable& var = reinterpret_cast<triton::ast::VariableNode*>(node->getChildren()[0].get())->getSymbolicVariable();
351 if (var->getAlias().empty())
352 stream << var->getName() << " = " << "int(input())";
353 else
354 stream << var->getAlias() << " = " << "int(input())";
355 }
356
357 else if (node->getChildren()[0]->getType() == ARRAY_NODE) {
358 stream << node->getChildren()[0] << " = bytearray()";
359 }
360
361 else {
362 throw triton::exceptions::AstRepresentation("AstSmtRepresentation::print(DeclareNode): Invalid sort.");
363 }
364
365 return stream;
366 }
367
368
369 /* distinct representation */
370 std::ostream& AstPythonRepresentation::print(std::ostream& stream, triton::ast::DistinctNode* node) {
371 stream << "(" << node->getChildren()[0] << " != " << node->getChildren()[1] << ")";
372 return stream;
373 }
374
375
376 /* equal representation */
377 std::ostream& AstPythonRepresentation::print(std::ostream& stream, triton::ast::EqualNode* node) {
378 stream << "(" << node->getChildren()[0] << " == " << node->getChildren()[1] << ")";
379 return stream;
380 }
381
382
383 /* extract representation */
384 std::ostream& AstPythonRepresentation::print(std::ostream& stream, triton::ast::ExtractNode* node) {
385 triton::uint32 low = triton::ast::getInteger<triton::uint32>(node->getChildren()[1]);
386
387 if (low == 0)
388 stream << "(" << node->getChildren()[2] << " & " << std::hex << "0x" << node->getBitvectorMask() << std::dec << ")";
389 else
390 stream << "((" << node->getChildren()[2] << " >> " << low << ")" << " & " << std::hex << "0x" << node->getBitvectorMask() << std::dec << ")";
391
392 return stream;
393 }
394
395
396 /* forall representation */
397 std::ostream& AstPythonRepresentation::print(std::ostream& stream, triton::ast::ForallNode* node) {
398 triton::usize size = node->getChildren().size() - 1;
399
400 stream << "forall([";
401 for (triton::uint32 i = 0; i != size; i++) {
402 const auto& var = reinterpret_cast<triton::ast::VariableNode*>(node->getChildren()[i].get())->getSymbolicVariable();
403 if (var->getAlias().empty()) stream << var->getName();
404 else stream << var->getAlias();
405 if (i + 1 != size) stream << ", ";
406 }
407 stream << "], " << node->getChildren()[size] << ")";
408
409 return stream;
410 }
411
412
413 /* iff representation */
414 std::ostream& AstPythonRepresentation::print(std::ostream& stream, triton::ast::IffNode* node) {
415 stream << "(" << node->getChildren()[0] << " and " << node->getChildren()[1] << ") or (not " << node->getChildren()[0] << " and not " << node->getChildren()[1] << ")";
416 return stream;
417 }
418
419
420 /* integer representation */
421 std::ostream& AstPythonRepresentation::print(std::ostream& stream, triton::ast::IntegerNode* node) {
422 stream << std::hex << "0x" << node->getInteger() << std::dec;
423 return stream;
424 }
425
426
427 /* ite representation */
428 std::ostream& AstPythonRepresentation::print(std::ostream& stream, triton::ast::IteNode* node) {
429 stream << "(" << node->getChildren()[1] << " if " << node->getChildren()[0] << " else " << node->getChildren()[2] << ")";
430 return stream;
431 }
432
433
434 /* land representation */
435 std::ostream& AstPythonRepresentation::print(std::ostream& stream, triton::ast::LandNode* node) {
436 triton::usize size = node->getChildren().size();
437
438 stream << "(" << node->getChildren()[0];
439 for (triton::usize index = 1; index < size; index++)
440 stream << " and " << node->getChildren()[index];
441 stream << ")";
442
443 return stream;
444 }
445
446
447 /* let representation */
448 std::ostream& AstPythonRepresentation::print(std::ostream& stream, triton::ast::LetNode* node) {
449 stream << node->getChildren()[2];
450 return stream;
451 }
452
453
454 /* lnot representation */
455 std::ostream& AstPythonRepresentation::print(std::ostream& stream, triton::ast::LnotNode* node) {
456 stream << "not " << node->getChildren()[0];
457 return stream;
458 }
459
460
461 /* lor representation */
462 std::ostream& AstPythonRepresentation::print(std::ostream& stream, triton::ast::LorNode* node) {
463 triton::usize size = node->getChildren().size();
464
465 stream << "(" << node->getChildren()[0];
466 for (triton::usize index = 1; index < size; index++)
467 stream << " or " << node->getChildren()[index];
468 stream << ")";
469
470 return stream;
471 }
472
473 /* lxor representation */
474 std::ostream& AstPythonRepresentation::print(std::ostream& stream, triton::ast::LxorNode* node) {
475 triton::usize size = node->getChildren().size();
476
477 stream << "(bool(" << node->getChildren()[0];
478 for (triton::usize index = 1; index < size; index++)
479 stream << ") != bool(" << node->getChildren()[index];
480 stream << "))";
481
482 return stream;
483 }
484
485 /* reference representation */
486 std::ostream& AstPythonRepresentation::print(std::ostream& stream, triton::ast::ReferenceNode* node) {
487 stream << node->getSymbolicExpression()->getFormattedId();
488 return stream;
489 }
490
491
492 /* select representation */
493 std::ostream& AstPythonRepresentation::print(std::ostream& stream, triton::ast::SelectNode* node) {
494 stream << "select(" << node->getChildren()[0] << ", " << node->getChildren()[1] << ")";
495 return stream;
496 }
497
498
499 /* store representation */
500 std::ostream& AstPythonRepresentation::print(std::ostream& stream, triton::ast::StoreNode* node) {
501 stream << "store(" << node->getChildren()[0] << ", " << node->getChildren()[1] << ", " << node->getChildren()[2] << ")";
502 return stream;
503 }
504
505
506 /* string representation */
507 std::ostream& AstPythonRepresentation::print(std::ostream& stream, triton::ast::StringNode* node) {
508 stream << node->getString();
509 return stream;
510 }
511
512
513 /* sx representation */
514 std::ostream& AstPythonRepresentation::print(std::ostream& stream, triton::ast::SxNode* node) {
515 triton::uint32 extend = triton::ast::getInteger<triton::uint32>(node->getChildren()[0]);
516
517 if (extend)
518 stream << "sx(" << node->getChildren()[0] << ", " << node->getChildren()[1] << ")";
519 else
520 stream << node->getChildren()[1];
521
522 return stream;
523 }
524
525
526 /* variable representation */
527 std::ostream& AstPythonRepresentation::print(std::ostream& stream, triton::ast::VariableNode* node) {
528 if (node->getSymbolicVariable()->getAlias().empty())
529 stream << node->getSymbolicVariable()->getName();
530 else
531 stream << node->getSymbolicVariable()->getAlias();
532 return stream;
533 }
534
535
536 /* zx representation */
537 std::ostream& AstPythonRepresentation::print(std::ostream& stream, triton::ast::ZxNode* node) {
538 stream << node->getChildren()[1];
539 return stream;
540 }
541
542 };
543 };
544};
Abstract node.
Definition ast.hpp:68
TRITON_EXPORT triton::uint512 getBitvectorMask(void) const
Returns the vector mask according the size of the node.
Definition ast.cpp:65
TRITON_EXPORT triton::uint32 getBitvectorSize(void) const
Returns the size of the node.
Definition ast.cpp:60
TRITON_EXPORT std::vector< SharedAbstractNode > & getChildren(void)
Returns the children of the node.
Definition ast.cpp:182
TRITON_EXPORT triton::ast::ast_e getType(void) const
Returns the type of the node.
Definition ast.cpp:55
(Array (_ BitVec indexSize) (_ BitVec 8)) node
Definition ast.hpp:193
(assert <expr>) node
Definition ast.hpp:231
(bswap <expr>) node
Definition ast.hpp:242
(_ bv<value> <size>) node
Definition ast.hpp:574
(bvadd <expr1> <expr2>) node
Definition ast.hpp:253
(bvand <expr1> <expr2>) node
Definition ast.hpp:264
(bvashr <expr1> <expr2>) node
Definition ast.hpp:275
(bvlshr <expr1> <expr2>) node
Definition ast.hpp:286
(bvmul <expr1> <expr2>) node
Definition ast.hpp:297
(bvnand <expr1> <expr2>) node
Definition ast.hpp:308
(bvneg <expr>) node
Definition ast.hpp:319
(bvnor <expr1> <expr2>) node
Definition ast.hpp:330
(bvnot <expr>) node
Definition ast.hpp:341
(bvor <expr1> <expr2>) node
Definition ast.hpp:352
((_ rotate_left rot) <expr>) node
Definition ast.hpp:363
((_ rotate_right rot) <expr>) node
Definition ast.hpp:375
(bvsdiv <expr1> <expr2>) node
Definition ast.hpp:387
(bvsge <expr1> <expr2>) node
Definition ast.hpp:398
(bvsgt <expr1> <expr2>) node
Definition ast.hpp:409
(bvshl <expr1> <expr2>) node
Definition ast.hpp:420
(bvsle <expr1> <expr2>) node
Definition ast.hpp:431
(bvslt <expr1> <expr2>) node
Definition ast.hpp:442
(bvsmod <expr1> <expr2>) node
Definition ast.hpp:453
(bvsrem <expr1> <expr2>) node
Definition ast.hpp:464
(bvsub <expr1> <expr2>) node
Definition ast.hpp:475
(bvudiv <expr1> <expr2>) node
Definition ast.hpp:486
(bvuge <expr1> <expr2>) node
Definition ast.hpp:497
(bvugt <expr1> <expr2>) node
Definition ast.hpp:508
(bvule <expr1> <expr2>) node
Definition ast.hpp:519
(bvult <expr1> <expr2>) node
Definition ast.hpp:530
(bvurem <expr1> <expr2>) node
Definition ast.hpp:541
(bvxnor <expr1> <expr2>) node
Definition ast.hpp:552
(bvxor <expr1> <expr2>) node
Definition ast.hpp:563
[<expr1> <expr2> <expr3> ...] node
Definition ast.hpp:585
(concat <expr1> <expr2> ...) node
Definition ast.hpp:601
(declare-fun <var_name> () (_ BitVec <var_size>)) node
Definition ast.hpp:618
(distinct <expr1> <expr2> ...) node
Definition ast.hpp:629
(= <expr1> <expr2> ...) node
Definition ast.hpp:640
((_ extract <high> <low>) <expr>) node
Definition ast.hpp:651
(forall ((x (_ BitVec <size>)), ...) body)
Definition ast.hpp:662
(iff <expr1> <expr2>)
Definition ast.hpp:679
Integer node.
Definition ast.hpp:690
(ite <ifExpr> <thenExpr> <elseExpr>)
Definition ast.hpp:705
(and <expr1> <expr2>)
Definition ast.hpp:716
(let ((<alias> <expr2>)) <expr3>)
Definition ast.hpp:733
(lnot <expr>)
Definition ast.hpp:744
(or <expr1> <expr2>)
Definition ast.hpp:755
(xor <expr1> <expr2>)
Definition ast.hpp:772
Reference node.
Definition ast.hpp:789
(select array index)
Definition ast.hpp:804
(store array index expr)
Definition ast.hpp:816
String node.
Definition ast.hpp:852
((_ sign_extend sizeExt) <expr>) node
Definition ast.hpp:867
Variable node.
Definition ast.hpp:878
((_ zero_extend sizeExt) <expr>) node
Definition ast.hpp:893
TRITON_EXPORT std::ostream & print(std::ostream &stream, triton::ast::AbstractNode *node)
Displays the node according to the representation mode.
The exception class used by all AST node representations.
std::shared_ptr< triton::engines::symbolic::SymbolicVariable > SharedSymbolicVariable
Shared Symbolic variable.
Definition ast.hpp:43
std::size_t usize
unsigned MAX_INT 32 or 64 bits according to the CPU.
std::uint32_t uint32
unisgned 32-bits
The Triton namespace.