souffle  2.0.2-371-g6315b36
AddNullariesToAtomlessAggregates.h
Go to the documentation of this file.
1 /*
2  * Souffle - A Datalog Compiler
3  * Copyright (c) 2020, The Souffle Developers. All rights reserved.
4  * Licensed under the Universal Permissive License v 1.0 as shown at:
5  * - https://opensource.org/licenses/UPL
6  * - <souffle root>/licenses/SOUFFLE-UPL.txt
7  */
8 
9 /************************************************************************
10  *
11  * @file AddNullariesToAtomlessAggregates.h
12  *
13  * Transformation pass to create artificial relations for bodies of
14  * aggregation functions consisting of more than a single atom.
15  *
16  * Transformation pass to add artificial nullary atom (+Tautology())
17  * to aggregate bodies that have no atoms. This is because the RAM expects
18  * all aggregates to refer to a relation.
19  *
20  ***********************************************************************/
21 
22 #pragma once
23 
24 #include "ast/TranslationUnit.h"
26 #include <string>
27 
28 namespace souffle::ast::transform {
29 
30 /**
31  * Transformation pass to add artificial nullary atom (+Tautology())
32  * to aggregate bodies that have no atoms.
33  */
34 class AddNullariesToAtomlessAggregatesTransformer : public Transformer {
35 public:
36  std::string getName() const override {
37  return "AddNullariesToAtomlessAggregatesTransformer";
38  }
39 
40  AddNullariesToAtomlessAggregatesTransformer* clone() const override {
41  return new AddNullariesToAtomlessAggregatesTransformer();
42  }
43 
44 private:
45  bool transform(TranslationUnit& translationUnit) override;
46 };
47 
48 } // namespace souffle::ast::transform
souffle::ast::transform::AddNullariesToAtomlessAggregatesTransformer::clone
AddNullariesToAtomlessAggregatesTransformer * clone() const override
Definition: AddNullariesToAtomlessAggregates.h:62
souffle::ast::transform::AddNullariesToAtomlessAggregatesTransformer::transform
bool transform(TranslationUnit &translationUnit) override
Definition: AddNullariesToAtomlessAggregates.cpp:38
TranslationUnit.h
Transformer.h
souffle::ast::TranslationUnit
Translation unit class for the translation pipeline.
Definition: TranslationUnit.h:51
souffle::ast::transform
Definition: Program.h:45
souffle::ast::transform::AddNullariesToAtomlessAggregatesTransformer::getName
std::string getName() const override
Definition: AddNullariesToAtomlessAggregates.h:58