souffle  2.0.2-371-g6315b36
NameUnnamedVariables.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 NameUnnamedVariables.h
12  *
13  * Transformation pass to replace unnamed variables
14  * with singletons.
15  * E.g.: a() :- b(_). -> a() :- b(x).
16  *
17  ***********************************************************************/
18 
19 #pragma once
20 
21 #include "ast/TranslationUnit.h"
23 #include <string>
24 
25 namespace souffle::ast::transform {
26 
27 /**
28  * Transformation pass to replace unnamed variables
29  * with singletons.
30  * E.g.: a() :- b(_). -> a() :- b(x).
31  */
32 class NameUnnamedVariablesTransformer : public Transformer {
33 public:
34  std::string getName() const override {
35  return "NameUnnamedVariablesTransformer";
36  }
37 
38  NameUnnamedVariablesTransformer* clone() const override {
39  return new NameUnnamedVariablesTransformer();
40  }
41 
42 private:
43  bool transform(TranslationUnit& translationUnit) override;
44 };
45 
46 } // namespace souffle::ast::transform
TranslationUnit.h
souffle::ast::transform::NameUnnamedVariablesTransformer::transform
bool transform(TranslationUnit &translationUnit) override
Definition: NameUnnamedVariables.cpp:36
Transformer.h
souffle::ast::transform::NameUnnamedVariablesTransformer::getName
std::string getName() const override
Definition: NameUnnamedVariables.h:50
souffle::ast::TranslationUnit
Translation unit class for the translation pipeline.
Definition: TranslationUnit.h:51
souffle::ast::transform
Definition: Program.h:45
souffle::ast::transform::NameUnnamedVariablesTransformer::clone
NameUnnamedVariablesTransformer * clone() const override
Definition: NameUnnamedVariables.h:54