/
ConstraintTranslator.h
52 lines (41 loc) · 1.44 KB
/
ConstraintTranslator.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*
* Souffle - A Datalog Compiler
* Copyright (c) 2020 The Souffle Developers. All rights reserved
* Licensed under the Universal Permissive License v 1.0 as shown at:
* - https://opensource.org/licenses/UPL
* - <souffle root>/licenses/SOUFFLE-UPL.txt
*/
/************************************************************************
*
* @file ConstraintTranslator.h
*
***********************************************************************/
#pragma once
#include "ast/utility/Visitor.h"
#include "souffle/utility/ContainerUtil.h"
namespace souffle::ast {
class Atom;
class BinaryConstraint;
class Negation;
class ProvenanceNegation;
} // namespace souffle::ast
namespace souffle::ram {
class Condition;
}
namespace souffle::ast2ram {
class ValueIndex;
class AstToRamTranslator;
class ConstraintTranslator : public ast::Visitor<Own<ram::Condition>> {
public:
ConstraintTranslator(AstToRamTranslator& translator, const ValueIndex& index)
: translator(translator), index(index) {}
/** -- Visitors -- */
Own<ram::Condition> visitAtom(const ast::Atom&) override;
Own<ram::Condition> visitBinaryConstraint(const ast::BinaryConstraint& binRel) override;
Own<ram::Condition> visitProvenanceNegation(const ast::ProvenanceNegation& neg) override;
Own<ram::Condition> visitNegation(const ast::Negation& neg) override;
private:
AstToRamTranslator& translator;
const ValueIndex& index;
};
} // namespace souffle::ast2ram