PerceMon
ast.hpp
1#pragma once
2
3#ifndef __PERCEMON_AST_AST_HPP__
4#define __PERCEMON_AST_AST_HPP__
5
6#include "percemon/ast/primitives.hpp"
7
8#include "percemon/ast/functions.hpp"
9
10#include <exception>
11#include <initializer_list>
12#include <memory>
13#include <optional>
14#include <string>
15#include <variant>
16#include <vector>
17
18namespace percemon::ast {
19
20using namespace primitives;
21using namespace functions;
22
23// TQTL Subset
24struct Exists;
25using ExistsPtr = std::shared_ptr<Exists>;
26struct Forall;
27using ForallPtr = std::shared_ptr<Forall>;
28struct Pin;
29using PinPtr = std::shared_ptr<Pin>;
30struct Not;
31using NotPtr = std::shared_ptr<Not>;
32struct And;
33using AndPtr = std::shared_ptr<And>;
34struct Or;
35using OrPtr = std::shared_ptr<Or>;
36struct Previous;
37using PreviousPtr = std::shared_ptr<Previous>;
38struct Always;
39using AlwaysPtr = std::shared_ptr<Always>;
40struct Sometimes;
41using SometimesPtr = std::shared_ptr<Sometimes>;
42struct Since;
43using SincePtr = std::shared_ptr<Since>;
44struct BackTo;
45using BackToPtr = std::shared_ptr<BackTo>;
46
47// Spatio Temporal subset
48struct Complement;
49using ComplementPtr = std::shared_ptr<Complement>;
50struct Intersect;
51using IntersectPtr = std::shared_ptr<Intersect>;
52struct Union;
53using UnionPtr = std::shared_ptr<Union>;
54struct Interior;
55using InteriorPtr = std::shared_ptr<Interior>;
56struct Closure;
57using ClosurePtr = std::shared_ptr<Closure>;
58
59struct SpExists;
60using SpExistsPtr = std::shared_ptr<SpExists>;
61struct SpForall;
62using SpForallPtr = std::shared_ptr<SpForall>;
63
64struct SpPrevious;
65using SpPreviousPtr = std::shared_ptr<SpPrevious>;
66struct SpAlways;
67using SpAlwaysPtr = std::shared_ptr<SpAlways>;
68struct SpSometimes;
69using SpSometimesPtr = std::shared_ptr<SpSometimes>;
70struct SpSince;
71using SpSincePtr = std::shared_ptr<SpSince>;
72struct SpBackTo;
73using SpBackToPtr = std::shared_ptr<SpBackTo>;
74
75struct CompareSpArea;
76using CompareSpAreaPtr = std::shared_ptr<CompareSpArea>;
77
78using Expr = std::variant<
79 // Primitives.
80 Const,
81 // Functions on Primitives
82 TimeBound,
83 FrameBound,
84 CompareId,
85 CompareProb,
86 CompareClass,
87 CompareED,
88 CompareLat,
89 CompareLon,
90 CompareArea,
91 // Quantifiers
92 ExistsPtr,
93 ForallPtr,
94 PinPtr,
95 // Temporal Operators
96 NotPtr,
97 AndPtr,
98 OrPtr,
99 PreviousPtr,
100 AlwaysPtr,
101 SometimesPtr,
102 SincePtr,
103 BackToPtr,
104 // Spatio-temporal operators
105 CompareSpAreaPtr,
106 SpExistsPtr,
107 SpForallPtr>;
108
109using SpatialExpr = std::variant<
110 EmptySet,
111 UniverseSet,
112 BBox,
113 ComplementPtr,
114 IntersectPtr,
115 UnionPtr,
116 InteriorPtr,
117 ClosurePtr,
118 SpPreviousPtr,
119 SpAlwaysPtr,
120 SpSometimesPtr,
121 SpSincePtr,
122 SpBackToPtr>;
123
124Expr operator~(const Expr& e);
125Expr operator&(const Expr& lhs, const Expr& rhs);
126Expr operator|(const Expr& lhs, const Expr& rhs);
127Expr operator>>(const Expr& lhs, const Expr& rhs);
128
129} // namespace percemon::ast
130
131#endif /* end of include guard: __PERCEMON_AST_AST_HPP__ */