souffle  2.0.2-371-g6315b36
TypeChecker.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 TypeChecker.h
12  *
13  * Defines the type checker pass (part of semantic checker)
14  * The type checker checks type declarations
15  * and if the declarations are valid it checks typing in clauses
16  *
17  ***********************************************************************/
18 
19 #pragma once
20 
21 #include "ast/TranslationUnit.h"
23 #include <string>
24 
25 namespace souffle::ast::transform {
26 
27 class TypeChecker : public Transformer {
28 public:
29  ~TypeChecker() override = default;
30 
31  std::string getName() const override {
32  return "TypeChecker";
33  }
34 
35  // `apply` but doesn't immediately bail if any errors are found.
36  void verify(TranslationUnit& translationUnit);
37 
38  TypeChecker* clone() const override {
39  return new TypeChecker();
40  }
41 
42 private:
43  bool transform(TranslationUnit& translationUnit) override {
44  verify(translationUnit);
45  return false;
46  }
47 };
48 } // namespace souffle::ast::transform
TranslationUnit.h
Transformer.h
souffle::ast::transform::TypeChecker::transform
bool transform(TranslationUnit &translationUnit) override
Definition: TypeChecker.h:59
souffle::ast::transform::TypeChecker::clone
TypeChecker * clone() const override
Definition: TypeChecker.h:54
souffle::ast::TranslationUnit
Translation unit class for the translation pipeline.
Definition: TranslationUnit.h:51
souffle::ast::transform::TypeChecker::verify
void verify(TranslationUnit &translationUnit)
Definition: TypeChecker.cpp:115
souffle::ast::transform
Definition: Program.h:45
souffle::ast::transform::TypeChecker
Definition: TypeChecker.h:35
souffle::ast::transform::TypeChecker::getName
std::string getName() const override
Definition: TypeChecker.h:47
souffle::ast::transform::TypeChecker::~TypeChecker
~TypeChecker() override=default