1 |
7
|
krennw
|
|
2 |
|
|
|
3 |
|
|
|
4 |
|
|
|
5 |
|
|
|
6 |
|
|
|
7 |
|
|
|
8 |
|
|
|
9 |
|
|
|
10 |
|
|
|
11 |
|
|
|
12 |
|
|
|
13 |
|
|
|
14 |
|
|
|
15 |
|
|
|
16 |
|
|
|
17 |
|
|
|
18 |
|
|
|
19 |
|
|
|
20 |
|
|
|
21 |
|
|
|
22 |
2
|
krennw
|
|
23 |
|
|
|
24 |
|
|
|
25 |
|
|
|
26 |
|
|
#pragma once
|
27 |
|
|
|
28 |
|
|
#include <cstdint>
|
29 |
|
|
#include <deque>
|
30 |
|
|
#include <base/TiresiasObject.hpp>
|
31 |
|
|
|
32 |
|
|
class CallContext;
|
33 |
|
|
|
34 |
|
|
namespace Ast {
|
35 |
|
|
|
36 |
|
|
|
37 |
|
|
|
38 |
|
|
|
39 |
|
|
class TypeIdentifier;
|
40 |
|
|
class EnumIdentifier;
|
41 |
|
|
|
42 |
|
|
class AttributeIdentifier;
|
43 |
|
|
class LocalVariableIdentifier;
|
44 |
|
|
class ParameterIdentifier;
|
45 |
|
|
class ExpressionVariableIdentifier;
|
46 |
|
|
class MethodIdentifier;
|
47 |
|
|
class NamedActionIdentifier;
|
48 |
|
|
class Module;
|
49 |
|
|
class ConstantIdentifier;
|
50 |
|
|
class IntType;
|
51 |
|
|
class BoolType;
|
52 |
|
|
class EnumType;
|
53 |
|
|
class ListType;
|
54 |
|
|
class TupleType;
|
55 |
|
|
class NullType;
|
56 |
|
|
class FunctionType;
|
57 |
|
|
class ActionSystemType;
|
58 |
|
|
class GuardedCommand;
|
59 |
|
|
class Call;
|
60 |
|
|
class Assignment;
|
61 |
|
|
class SeqBlock;
|
62 |
|
|
class NondetBlock;
|
63 |
|
|
class PrioBlock;
|
64 |
|
|
class Skip;
|
65 |
|
|
class Break;
|
66 |
|
|
class Abort;
|
67 |
|
|
class TernaryOperator;
|
68 |
|
|
class BinaryOperator;
|
69 |
|
|
class UnaryOperator;
|
70 |
|
|
class ExistsQuantifier;
|
71 |
|
|
class ForallQuantifier;
|
72 |
|
|
class ListConstructor;
|
73 |
|
|
class SetConstructor;
|
74 |
|
|
class TupleConstructor;
|
75 |
|
|
class ObjectConstructor;
|
76 |
|
|
class IdentifierExpression;
|
77 |
|
|
class BoolValueExpression;
|
78 |
|
|
class IntValueExpression;
|
79 |
|
|
class RefValueExpression;
|
80 |
|
|
class TypeExpression;
|
81 |
|
|
class TupleMapAccessExpression;
|
82 |
|
|
class CallExpression;
|
83 |
|
|
class AccessExpression;
|
84 |
|
|
class UnspecIdentifierBlock;
|
85 |
|
|
class SeqIdentifierBlock;
|
86 |
|
|
class NondetIdentifierBlock;
|
87 |
|
|
class PrioIdentifierBlock;
|
88 |
|
|
class MainModule;
|
89 |
|
|
class PointerType;
|
90 |
|
|
class ActionSystemInstance;
|
91 |
|
|
class ValuedEnumType;
|
92 |
|
|
|
93 |
|
|
|
94 |
|
|
class ExpressionList;
|
95 |
|
|
class StatementList;
|
96 |
|
|
class IdentifierList;
|
97 |
|
|
class ParameterList;
|
98 |
|
|
class TypeList;
|
99 |
|
|
class ActionSystemInstanceList;
|
100 |
|
|
|
101 |
|
|
enum class ExpressionKind: std::uint8_t;
|
102 |
|
|
enum class TypeKind : std::uint8_t;
|
103 |
|
|
enum class StatementKind: std::uint8_t;
|
104 |
|
|
enum class IdentifierKind: std::uint8_t;
|
105 |
|
|
|
106 |
|
|
class SymbolTable;
|
107 |
|
|
class Type;
|
108 |
|
|
class Statement;
|
109 |
|
|
class Identifier;
|
110 |
|
|
class Expression;
|
111 |
|
|
|
112 |
|
|
|
113 |
|
|
|
114 |
|
|
class Ast final {
|
115 |
|
|
private:
|
116 |
|
|
CallContext* m_context;
|
117 |
|
|
|
118 |
|
|
std::deque<Base::TiresiasObject*> m_allocatedAstObjects;
|
119 |
|
|
|
120 |
|
|
Base::TiresiasObject* takeOwnership(Base::TiresiasObject* obj);
|
121 |
|
|
public:
|
122 |
|
|
Ast(CallContext* context);
|
123 |
|
|
~Ast();
|
124 |
|
|
|
125 |
|
|
|
126 |
|
|
|
127 |
|
|
|
128 |
|
|
|
129 |
|
|
Type* createType(TypeKind t);
|
130 |
|
|
Type* createType(const Type& toCopy);
|
131 |
|
|
|
132 |
|
|
Statement* createStatement(StatementKind t);
|
133 |
|
|
Statement* createStatement(const Statement& toCopy);
|
134 |
|
|
Statement* deepCopyStatement(Statement* toCopy);
|
135 |
|
|
|
136 |
|
|
Identifier* createIdentifier(IdentifierKind t);
|
137 |
|
|
Identifier* createIdentifier(const Identifier& toCopy);
|
138 |
|
|
|
139 |
|
|
Expression* createExpression(ExpressionKind t);
|
140 |
|
|
Expression* createExpression(const Expression& toCopy);
|
141 |
|
|
Expression* deepCopyExpression(Expression* toCopy);
|
142 |
|
|
|
143 |
|
|
ActionSystemInstance* createActionSystemInstance();
|
144 |
|
|
ActionSystemInstance* createActionSystemInstance(const ActionSystemInstance& toCopy);
|
145 |
|
|
|
146 |
|
|
ExpressionList* createExpressionList();
|
147 |
|
|
ExpressionList* createExpressionList(const ExpressionList& toCopy);
|
148 |
|
|
|
149 |
|
|
IdentifierList* createIdentifierList();
|
150 |
|
|
IdentifierList* createIdentifierList(const IdentifierList& toCopy);
|
151 |
|
|
|
152 |
|
|
StatementList* createStatementList();
|
153 |
|
|
StatementList* createStatementList(const StatementList& toCopy);
|
154 |
|
|
|
155 |
|
|
ParameterList* createParameterList();
|
156 |
|
|
ParameterList* createParameterList(const ParameterList& toCopy);
|
157 |
|
|
|
158 |
|
|
TypeList* createTypeList();
|
159 |
|
|
TypeList* createTypeList(const TypeList& toCopy);
|
160 |
|
|
|
161 |
|
|
ActionSystemInstanceList* createActionSystemInstanceList();
|
162 |
|
|
ActionSystemInstanceList* createActionSystemInstanceList(const ActionSystemInstanceList& toCopy);
|
163 |
|
|
|
164 |
|
|
SymbolTable* createSymbolTable();
|
165 |
|
|
SymbolTable* createSymbolTable(const SymbolTable& toCopy);
|
166 |
|
|
};
|
167 |
|
|
|
168 |
|
|
} |