-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26 from LangProc/dev
Merge last year dev changes to main
- Loading branch information
Showing
35 changed files
with
339 additions
and
427 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
#ifndef AST_CONTEXT_HPP | ||
#define AST_CONTEXT_HPP | ||
#pragma once | ||
|
||
// An object of class Context is passed between AST nodes during compilation. | ||
namespace ast { | ||
// An object of class Context is passed between ast nodes during compilation. | ||
// This can be used to pass around information about what's currently being | ||
// compiled (e.g. function scope and variable names). | ||
class Context | ||
{ | ||
/* TODO decide what goes inside here */ | ||
}; | ||
|
||
#endif | ||
} // namespace ast |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,19 @@ | ||
#ifndef AST_DIRECT_DECLARATOR_HPP | ||
#define AST_DIRECT_DECLARATOR_HPP | ||
#pragma once | ||
|
||
#include "ast_node.hpp" | ||
|
||
namespace ast { | ||
|
||
class DirectDeclarator : public Node | ||
{ | ||
private: | ||
Node *identifier_; | ||
NodePtr identifier_; | ||
|
||
public: | ||
DirectDeclarator(Node *identifier) : identifier_(identifier){}; | ||
~DirectDeclarator() | ||
{ | ||
delete identifier_; | ||
}; | ||
void EmitRISC(std::ostream &stream, Context &context) const override; | ||
void Print(std::ostream &stream) const override; | ||
DirectDeclarator(NodePtr identifier) : identifier_(std::move(identifier)){}; | ||
|
||
void EmitRISC(std::ostream& stream, Context& context) const override; | ||
void Print(std::ostream& stream) const override; | ||
}; | ||
|
||
#endif | ||
} // namespace ast |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,22 @@ | ||
#ifndef AST_FUNCTION_DEFINITION_HPP | ||
#define AST_FUNCTION_DEFINITION_HPP | ||
#pragma once | ||
|
||
#include "ast_node.hpp" | ||
#include "ast_type_specifier.hpp" | ||
|
||
namespace ast { | ||
|
||
class FunctionDefinition : public Node | ||
{ | ||
|
||
private: | ||
|
||
Node *declaration_specifiers_; | ||
Node *declarator_; | ||
Node *compound_statement_; | ||
const TypeSpecifier declaration_specifiers_; | ||
NodePtr declarator_; | ||
NodePtr compound_statement_; | ||
|
||
public: | ||
|
||
FunctionDefinition | ||
(Node *declaration_specifiers, | ||
Node *declarator, | ||
Node *compound_statement) : | ||
declaration_specifiers_(declaration_specifiers), | ||
declarator_(declarator), | ||
compound_statement_(compound_statement){}; | ||
|
||
~FunctionDefinition() | ||
{ | ||
delete declaration_specifiers_; | ||
delete declarator_; | ||
delete compound_statement_; | ||
}; | ||
|
||
void EmitRISC(std::ostream &stream, Context &context) const override; | ||
|
||
void Print(std::ostream &stream) const override; | ||
FunctionDefinition(TypeSpecifier declaration_specifiers, NodePtr declarator, NodePtr compound_statement) : declaration_specifiers_(declaration_specifiers), declarator_(std::move(declarator)), compound_statement_(std::move(compound_statement)){}; | ||
|
||
void EmitRISC(std::ostream& stream, Context& context) const override; | ||
void Print(std::ostream& stream) const override; | ||
}; | ||
|
||
#endif | ||
} // namespace ast |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,19 @@ | ||
#ifndef AST_IDENTIFIER_HPP | ||
#define AST_IDENTIFIER_HPP | ||
#pragma once | ||
|
||
#include "ast_node.hpp" | ||
|
||
namespace ast { | ||
|
||
class Identifier : public Node | ||
{ | ||
private: | ||
std::string identifier_; | ||
|
||
public: | ||
Identifier(std::string identifier) : identifier_(identifier){}; | ||
~Identifier(){}; | ||
void EmitRISC(std::ostream &stream, Context &context) const override; | ||
void Print(std::ostream &stream) const override; | ||
Identifier(std::string identifier) : identifier_(std::move(identifier)){}; | ||
|
||
void EmitRISC(std::ostream& stream, Context& context) const override; | ||
void Print(std::ostream& stream) const override; | ||
}; | ||
|
||
#endif | ||
} // namespace ast |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,19 @@ | ||
#ifndef AST_JUMP_STATEMENT_HPP | ||
#define AST_JUMP_STATEMENT_HPP | ||
#pragma once | ||
|
||
#include "ast_node.hpp" | ||
|
||
namespace ast { | ||
|
||
class ReturnStatement : public Node | ||
{ | ||
private: | ||
Node *expression_; | ||
NodePtr expression_; | ||
|
||
public: | ||
ReturnStatement(Node *expression) : expression_(expression) {} | ||
~ReturnStatement() | ||
{ | ||
delete expression_; | ||
}; | ||
ReturnStatement(NodePtr expression) : expression_(std::move(expression)) {} | ||
|
||
void EmitRISC(std::ostream &stream, Context &context) const override; | ||
void Print(std::ostream &stream) const override; | ||
void EmitRISC(std::ostream& stream, Context& context) const override; | ||
void Print(std::ostream& stream) const override; | ||
}; | ||
|
||
#endif | ||
} // namespace ast |
Oops, something went wrong.