souffle  2.0.2-371-g6315b36
ReplaceSingletonVariables.h
Go to the documentation of this file.
1 /*
2  * Souffle - A Datalog Compiler
3  * Copyright (c) 2018, 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 ReplaceSingletonVariables.h
12  *
13  ***********************************************************************/
14 
15 #pragma once
16 
17 #include "ast/TranslationUnit.h"
19 #include <string>
20 
21 namespace souffle::ast::transform {
22 
23 /**
24  * Transformation pass to replace singleton variables
25  * with unnamed variables.
26  * E.g.: a() :- b(x). -> a() :- b(_).
27  */
28 class ReplaceSingletonVariablesTransformer : public Transformer {
29 public:
30  std::string getName() const override {
31  return "ReplaceSingletonVariablesTransformer";
32  }
33 
36  }
37 
38 private:
39  bool transform(TranslationUnit& translationUnit) override;
40 };
41 
42 } // namespace souffle::ast::transform
souffle::ast::transform::ReplaceSingletonVariablesTransformer::clone
ReplaceSingletonVariablesTransformer * clone() const override
Definition: ReplaceSingletonVariables.h:42
TranslationUnit.h
souffle::ast::transform::ReplaceSingletonVariablesTransformer::transform
bool transform(TranslationUnit &translationUnit) override
Definition: ReplaceSingletonVariables.cpp:38
souffle::ast::transform::ReplaceSingletonVariablesTransformer
Transformation pass to replace singleton variables with unnamed variables.
Definition: ReplaceSingletonVariables.h:32
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::ReplaceSingletonVariablesTransformer::getName
std::string getName() const override
Definition: ReplaceSingletonVariables.h:38