From cf6548be6726c0126faf4c9f554faa12f9d9ac8e Mon Sep 17 00:00:00 2001 From: Ange Yaghi Date: Tue, 20 Aug 2019 20:37:35 -0400 Subject: [PATCH 1/5] [#38] : Added root unit to NodeProgram --- include/node_program.h | 6 ++++++ include/version.h | 2 +- src/ir_compilation_unit.cpp | 3 ++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/include/node_program.h b/include/node_program.h index 905ae098..802d7e37 100644 --- a/include/node_program.h +++ b/include/node_program.h @@ -3,6 +3,7 @@ #include "node_container.h" #include "pkey_value_lookup.h" +#include "ir_compilation_unit.h" #include @@ -35,7 +36,12 @@ namespace piranha { std::string getRuntimeError() const { return m_errorMessage; } void throwRuntimeError(const std::string &msg, Node *node); + void setRootUnit(IrCompilationUnit *unit) { m_rootUnit = unit; } + IrCompilationUnit *getRootUnit() const { return m_rootUnit; } + protected: + IrCompilationUnit *m_rootUnit; + NodeContainer m_topLevelContainer; PKeyValueLookup m_containers; diff --git a/include/version.h b/include/version.h index a1314cf4..8786c855 100644 --- a/include/version.h +++ b/include/version.h @@ -1,6 +1,6 @@ #ifndef PIRANHA_VERSION_H #define PIRANHA_VERSION_H -#define PIRANHA_VERSION "v0.0.4a" +#define PIRANHA_VERSION "v0.0.5a" #endif /* PIRANHA_VERSION_H */ diff --git a/src/ir_compilation_unit.cpp b/src/ir_compilation_unit.cpp index 16cefba4..7b027898 100644 --- a/src/ir_compilation_unit.cpp +++ b/src/ir_compilation_unit.cpp @@ -24,6 +24,7 @@ piranha::IrCompilationUnit::~IrCompilationUnit() { void piranha::IrCompilationUnit::build(NodeProgram *program) { IrContextTree *context = new IrContextTree(nullptr); + program->setRootUnit(this); program->addContainer(context, program->getTopLevelContainer()); int nodeCount = getNodeCount(); @@ -335,7 +336,7 @@ void piranha::IrCompilationUnit::addImportStatement(IrImportStatement *statement } } -piranha::IrImportStatement * piranha::IrCompilationUnit::getImportStatement(int index) const { +piranha::IrImportStatement *piranha::IrCompilationUnit::getImportStatement(int index) const { return m_importStatements[index]; } From 90509998f344de5ed2a5328b5c9562d114b10f69 Mon Sep 17 00:00:00 2001 From: Ange Yaghi Date: Fri, 30 Aug 2019 21:21:29 -0400 Subject: [PATCH 2/5] [#40] : Added reference to readme --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 0eece800..532a4b46 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,8 @@ Piranha is currently used as an SDL (scene description language) for the [MantaRay](https://github.com/ange-yaghi/manta-ray) ray-tracer. +To get syntax highlighting in Visual Studio Code, checkout this project: [Piranha VS Code Extension](https://github.com/ange-yaghi/piranha-vscode-extension) + To get started, check out the introductory handbook: [Piranha Handbook](https://github.com/ange-yaghi/piranha/blob/master/docs/handbook/handbook.md) Example Piranha compiler implementation: [Hello World Piranha Compiler](https://github.com/ange-yaghi/piranha-hello-world-compiler) From 76748389021f1fcc0f8d3cef4569ba012f8c563b Mon Sep 17 00:00:00 2001 From: Ange Yaghi Date: Fri, 30 Aug 2019 21:23:40 -0400 Subject: [PATCH 3/5] [#40] : Removed absolute URL --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 532a4b46..dd857885 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Piranha is currently used as an SDL (scene description language) for the [MantaR To get syntax highlighting in Visual Studio Code, checkout this project: [Piranha VS Code Extension](https://github.com/ange-yaghi/piranha-vscode-extension) -To get started, check out the introductory handbook: [Piranha Handbook](https://github.com/ange-yaghi/piranha/blob/master/docs/handbook/handbook.md) +To get started, check out the introductory handbook: [Piranha Handbook](docs/handbook/handbook.md) Example Piranha compiler implementation: [Hello World Piranha Compiler](https://github.com/ange-yaghi/piranha-hello-world-compiler) From 9432d1b68c42da8bb7ad25431f29085ec1f50d1d Mon Sep 17 00:00:00 2001 From: Ange Yaghi Date: Fri, 30 Aug 2019 21:25:16 -0400 Subject: [PATCH 4/5] [#40] : Added reference to the handbook --- docs/handbook/handbook.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/handbook/handbook.md b/docs/handbook/handbook.md index 9192d99b..8fe59174 100644 --- a/docs/handbook/handbook.md +++ b/docs/handbook/handbook.md @@ -51,6 +51,8 @@ Piranha is a configurable programming language that allows for easy object-orien Most examples given in this manual use a completely hypothetical Piranha language and thus cannot be run. Running examples are given in the [Hello World Compiler Tutorial](#3.2). +For syntax highlighting, check out this project: [Piranha Visual Studio Code Extension](https://github.com/ange-yaghi/piranha-vscode-extension) + # 2 Syntax Overview ## 2.1 Literals From 52f558a548d65d0446e5d0dbc3a5a49e4cc2a5d3 Mon Sep 17 00:00:00 2001 From: Ange Yaghi Date: Fri, 30 Aug 2019 21:26:54 -0400 Subject: [PATCH 5/5] [#40] : Updated readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index dd857885..b3038297 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ Piranha is currently used as an SDL (scene description language) for the [MantaRay](https://github.com/ange-yaghi/manta-ray) ray-tracer. -To get syntax highlighting in Visual Studio Code, checkout this project: [Piranha VS Code Extension](https://github.com/ange-yaghi/piranha-vscode-extension) +For syntax highlighting in Visual Studio Code check out the [Piranha Visual Studio Code Extension](https://github.com/ange-yaghi/piranha-vscode-extension). To get started, check out the introductory handbook: [Piranha Handbook](docs/handbook/handbook.md)