diff --git a/README.md b/README.md index 0eece800..b3038297 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,9 @@ Piranha is currently used as an SDL (scene description language) for the [MantaRay](https://github.com/ange-yaghi/manta-ray) ray-tracer. -To get started, check out the introductory handbook: [Piranha Handbook](https://github.com/ange-yaghi/piranha/blob/master/docs/handbook/handbook.md) +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) Example Piranha compiler implementation: [Hello World Piranha Compiler](https://github.com/ange-yaghi/piranha-hello-world-compiler) 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 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]; }