| 1 | // | 
|---|
| 2 | // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo | 
|---|
| 3 | // | 
|---|
| 4 | // The contents of this file are covered under the licence agreement in the | 
|---|
| 5 | // file "LICENCE" distributed with Cforall. | 
|---|
| 6 | // | 
|---|
| 7 | // Resolver.h -- | 
|---|
| 8 | // | 
|---|
| 9 | // Author           : Richard C. Bilson | 
|---|
| 10 | // Created On       : Sun May 17 12:18:34 2015 | 
|---|
| 11 | // Last Modified By : Peter A. Buhr | 
|---|
| 12 | // Last Modified On : Mon Feb 18 20:40:38 2019 | 
|---|
| 13 | // Update Count     : 4 | 
|---|
| 14 | // | 
|---|
| 15 |  | 
|---|
| 16 | #pragma once | 
|---|
| 17 |  | 
|---|
| 18 | #include <list>          // for list | 
|---|
| 19 |  | 
|---|
| 20 | #include "AST/Node.hpp"  // for ptr | 
|---|
| 21 |  | 
|---|
| 22 | class ConstructorInit; | 
|---|
| 23 | class Declaration; | 
|---|
| 24 | class Expression; | 
|---|
| 25 | class StmtExpr; | 
|---|
| 26 | namespace SymTab { | 
|---|
| 27 | class Indexer; | 
|---|
| 28 | } // namespace SymTab | 
|---|
| 29 |  | 
|---|
| 30 | namespace ast { | 
|---|
| 31 | class ConstructorInit; | 
|---|
| 32 | class Decl; | 
|---|
| 33 | class DeletedExpr; | 
|---|
| 34 | class Init; | 
|---|
| 35 | class StmtExpr; | 
|---|
| 36 | class SymbolTable; | 
|---|
| 37 | class Type; | 
|---|
| 38 | class TypeEnvironment; | 
|---|
| 39 | } // namespace ast | 
|---|
| 40 |  | 
|---|
| 41 | namespace ResolvExpr { | 
|---|
| 42 | /// Checks types and binds syntactic constructs to typed representations | 
|---|
| 43 | void resolve( std::list< Declaration * > translationUnit ); | 
|---|
| 44 | void resolveDecl( Declaration *, const SymTab::Indexer & indexer ); | 
|---|
| 45 | Expression *resolveInVoidContext( Expression * expr, const SymTab::Indexer & indexer ); | 
|---|
| 46 | void findVoidExpression( Expression *& untyped, const SymTab::Indexer & indexer ); | 
|---|
| 47 | void findSingleExpression( Expression *& untyped, const SymTab::Indexer & indexer ); | 
|---|
| 48 | void findSingleExpression( Expression *& untyped, Type * type, const SymTab::Indexer & indexer ); | 
|---|
| 49 | void resolveCtorInit( ConstructorInit * ctorInit, const SymTab::Indexer & indexer ); | 
|---|
| 50 | void resolveStmtExpr( StmtExpr * stmtExpr, const SymTab::Indexer & indexer ); | 
|---|
| 51 | /// Searches expr and returns the first DeletedExpr found, otherwise nullptr | 
|---|
| 52 | DeletedExpr * findDeletedExpr( Expression * expr ); | 
|---|
| 53 | /// Resolves with-stmts and with-clauses on functions | 
|---|
| 54 | void resolveWithExprs( std::list< Declaration * > & translationUnit ); | 
|---|
| 55 |  | 
|---|
| 56 | /// Checks types and binds syntactic constructs to typed representations | 
|---|
| 57 | void resolve( std::list< ast::ptr<ast::Decl> >& translationUnit ); | 
|---|
| 58 | /// Searches expr and returns the first DeletedExpr found, otherwise nullptr | 
|---|
| 59 | const ast::DeletedExpr * findDeletedExpr( const ast::Expr * expr ); | 
|---|
| 60 | /// Find the expression candidate that is the unique best match for `untyped` in a `void` | 
|---|
| 61 | /// context. | 
|---|
| 62 | ast::ptr< ast::Expr > resolveInVoidContext( | 
|---|
| 63 | const ast::Expr * expr, const ast::SymbolTable & symtab, ast::TypeEnvironment & env ); | 
|---|
| 64 | /// Resolve `untyped` to the single expression whose candidate is the best match for the | 
|---|
| 65 | /// given type. | 
|---|
| 66 | ast::ptr< ast::Expr > findSingleExpression( | 
|---|
| 67 | const ast::Expr * untyped, const ast::Type * type, const ast::SymbolTable & symtab ); | 
|---|
| 68 | /// Resolves a constructor init expression | 
|---|
| 69 | ast::ptr< ast::Init > resolveCtorInit( | 
|---|
| 70 | const ast::ConstructorInit * ctorInit, const ast::SymbolTable & symtab ); | 
|---|
| 71 | /// Resolves a statement expression | 
|---|
| 72 | ast::ptr< ast::Expr > resolveStmtExpr( | 
|---|
| 73 | const ast::StmtExpr * stmtExpr, const ast::SymbolTable & symtab ); | 
|---|
| 74 | } // namespace ResolvExpr | 
|---|
| 75 |  | 
|---|
| 76 | // Local Variables: // | 
|---|
| 77 | // tab-width: 4 // | 
|---|
| 78 | // mode: c++ // | 
|---|
| 79 | // compile-command: "make install" // | 
|---|
| 80 | // End: // | 
|---|