| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef SKSL_IRGENERATOR | 8 #ifndef SKSL_IRGENERATOR |
| 9 #define SKSL_IRGENERATOR | 9 #define SKSL_IRGENERATOR |
| 10 | 10 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 | 49 |
| 50 /** | 50 /** |
| 51 * Performs semantic analysis on an abstract syntax tree (AST) and produces the
corresponding | 51 * Performs semantic analysis on an abstract syntax tree (AST) and produces the
corresponding |
| 52 * (unoptimized) intermediate representation (IR). | 52 * (unoptimized) intermediate representation (IR). |
| 53 */ | 53 */ |
| 54 class IRGenerator { | 54 class IRGenerator { |
| 55 public: | 55 public: |
| 56 IRGenerator(const Context* context, std::shared_ptr<SymbolTable> root, | 56 IRGenerator(const Context* context, std::shared_ptr<SymbolTable> root, |
| 57 ErrorReporter& errorReporter); | 57 ErrorReporter& errorReporter); |
| 58 | 58 |
| 59 std::unique_ptr<VarDeclaration> convertVarDeclaration(const ASTVarDeclaratio
n& decl, | 59 std::unique_ptr<VarDeclarations> convertVarDeclarations(const ASTVarDeclarat
ions& decl, |
| 60 Variable::Storage stor
age); | 60 Variable::Storage st
orage); |
| 61 std::unique_ptr<FunctionDefinition> convertFunction(const ASTFunction& f); | 61 std::unique_ptr<FunctionDefinition> convertFunction(const ASTFunction& f); |
| 62 std::unique_ptr<Statement> convertStatement(const ASTStatement& statement); | 62 std::unique_ptr<Statement> convertStatement(const ASTStatement& statement); |
| 63 std::unique_ptr<Expression> convertExpression(const ASTExpression& expressio
n); | 63 std::unique_ptr<Expression> convertExpression(const ASTExpression& expressio
n); |
| 64 | 64 |
| 65 private: | 65 private: |
| 66 void pushSymbolTable(); | 66 void pushSymbolTable(); |
| 67 void popSymbolTable(); | 67 void popSymbolTable(); |
| 68 | 68 |
| 69 const Type* convertType(const ASTType& type); | 69 const Type* convertType(const ASTType& type); |
| 70 std::unique_ptr<Expression> call(Position position, | 70 std::unique_ptr<Expression> call(Position position, |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 std::shared_ptr<SymbolTable> fSymbolTable; | 114 std::shared_ptr<SymbolTable> fSymbolTable; |
| 115 ErrorReporter& fErrors; | 115 ErrorReporter& fErrors; |
| 116 | 116 |
| 117 friend class AutoSymbolTable; | 117 friend class AutoSymbolTable; |
| 118 friend class Compiler; | 118 friend class Compiler; |
| 119 }; | 119 }; |
| 120 | 120 |
| 121 } | 121 } |
| 122 | 122 |
| 123 #endif | 123 #endif |
| OLD | NEW |