summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustyna Att Ilczuk <justyna.ilczuk@gmail.com>2012-11-17 17:02:32 +0100
committerJustyna Att Ilczuk <justyna.ilczuk@gmail.com>2012-11-17 17:02:32 +0100
commit6e376d5b1c25d72f2c3170b18b1bd279747d7260 (patch)
treef805d59c5330c215a1d60a032de793b759d51acc
parent665492878d8e1eb6f864241ea799af6eeb52860e (diff)
downloadsencha-lang-6e376d5b1c25d72f2c3170b18b1bd279747d7260.tar.gz
sencha-lang-6e376d5b1c25d72f2c3170b18b1bd279747d7260.tar.bz2
sencha-lang-6e376d5b1c25d72f2c3170b18b1bd279747d7260.tar.xz
sencha-lang-6e376d5b1c25d72f2c3170b18b1bd279747d7260.zip
AST part moved into AST folder.
-rw-r--r--Sencha-lang/.cproject22
-rw-r--r--Sencha-lang/AST/AST.cpp19
-rw-r--r--Sencha-lang/AST/AST.h23
-rw-r--r--Sencha-lang/AST/ASTExpression.cpp18
-rw-r--r--Sencha-lang/AST/ASTExpression.h18
-rw-r--r--Sencha-lang/AST/ASTNode.cpp18
-rw-r--r--Sencha-lang/AST/ASTNode.h24
-rw-r--r--Sencha-lang/AST/ASTPrimary.cpp20
-rw-r--r--Sencha-lang/AST/ASTPrimary.h23
-rw-r--r--Sencha-lang/AST/ASTProgram.cpp21
-rw-r--r--Sencha-lang/AST/ASTProgram.h22
-rw-r--r--Sencha-lang/AST/ASTStatement.cpp18
-rw-r--r--Sencha-lang/AST/ASTStatement.h18
-rw-r--r--Sencha-lang/AST/AllTypesOfASTNodes.h20
14 files changed, 277 insertions, 7 deletions
diff --git a/Sencha-lang/.cproject b/Sencha-lang/.cproject
index cb07a7f..ef991be 100644
--- a/Sencha-lang/.cproject
+++ b/Sencha-lang/.cproject
@@ -43,7 +43,8 @@
</toolChain>
</folderInfo>
<sourceEntries>
- <entry excluding="Tests" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
+ <entry excluding="AST|Tests" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
+ <entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="AST"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="Tests"/>
</sourceEntries>
</configuration>
@@ -67,15 +68,15 @@
<folderInfo id="cdt.managedbuild.config.gnu.cross.exe.release.1985450505." name="/" resourcePath="">
<toolChain id="cdt.managedbuild.toolchain.gnu.cross.exe.release.1226114014" name="Cross GCC" superClass="cdt.managedbuild.toolchain.gnu.cross.exe.release">
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="cdt.managedbuild.targetPlatform.gnu.cross.676474921" isAbstract="false" osList="all" superClass="cdt.managedbuild.targetPlatform.gnu.cross"/>
- <builder buildPath="${workspace_loc:/Sencha-lang/Release}" id="cdt.managedbuild.builder.gnu.cross.23375219" managedBuildOn="true" name="Gnu Make Builder.Release" superClass="cdt.managedbuild.builder.gnu.cross"/>
+ <builder buildPath="${workspace_loc:/Sencha-lang/Release}" id="cdt.managedbuild.builder.gnu.cross.23375219" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="cdt.managedbuild.builder.gnu.cross"/>
<tool id="cdt.managedbuild.tool.gnu.cross.c.compiler.671993191" name="Cross GCC Compiler" superClass="cdt.managedbuild.tool.gnu.cross.c.compiler">
- <option defaultValue="gnu.c.optimization.level.most" id="gnu.c.compiler.option.optimization.level.1104799874" superClass="gnu.c.compiler.option.optimization.level" valueType="enumerated"/>
- <option id="gnu.c.compiler.option.debugging.level.1423670337" superClass="gnu.c.compiler.option.debugging.level" value="gnu.c.debugging.level.none" valueType="enumerated"/>
+ <option defaultValue="gnu.c.optimization.level.most" id="gnu.c.compiler.option.optimization.level.1104799874" name="Optimization Level" superClass="gnu.c.compiler.option.optimization.level" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.debugging.level.1423670337" name="Debug Level" superClass="gnu.c.compiler.option.debugging.level" value="gnu.c.debugging.level.none" valueType="enumerated"/>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1507898701" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.cross.cpp.compiler.938543294" name="Cross G++ Compiler" superClass="cdt.managedbuild.tool.gnu.cross.cpp.compiler">
- <option id="gnu.cpp.compiler.option.optimization.level.491096180" superClass="gnu.cpp.compiler.option.optimization.level" value="gnu.cpp.compiler.optimization.level.most" valueType="enumerated"/>
- <option id="gnu.cpp.compiler.option.debugging.level.1816198684" superClass="gnu.cpp.compiler.option.debugging.level" value="gnu.cpp.compiler.debugging.level.none" valueType="enumerated"/>
+ <option id="gnu.cpp.compiler.option.optimization.level.491096180" name="Optimization Level" superClass="gnu.cpp.compiler.option.optimization.level" value="gnu.cpp.compiler.optimization.level.most" valueType="enumerated"/>
+ <option id="gnu.cpp.compiler.option.debugging.level.1816198684" name="Debug Level" superClass="gnu.cpp.compiler.option.debugging.level" value="gnu.cpp.compiler.debugging.level.none" valueType="enumerated"/>
<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.599623873" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.cross.c.linker.1203418436" name="Cross GCC Linker" superClass="cdt.managedbuild.tool.gnu.cross.c.linker"/>
@@ -115,6 +116,13 @@
</scannerConfigBuildInfo>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
- <storageModule moduleId="refreshScope"/>
+ <storageModule moduleId="refreshScope" versionNumber="2">
+ <configuration configurationName="Release">
+ <resource resourceType="PROJECT" workspacePath="/Sencha-lang"/>
+ </configuration>
+ <configuration configurationName="Debug">
+ <resource resourceType="PROJECT" workspacePath="/Sencha-lang"/>
+ </configuration>
+ </storageModule>
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
</cproject>
diff --git a/Sencha-lang/AST/AST.cpp b/Sencha-lang/AST/AST.cpp
new file mode 100644
index 0000000..d31be57
--- /dev/null
+++ b/Sencha-lang/AST/AST.cpp
@@ -0,0 +1,19 @@
+/*
+ * AST.cpp
+ *
+ * Created on: Nov 4, 2012
+ * Author: attero
+ */
+#include "AST.h"
+#include "AllTypesOfASTNodes.h"
+
+AST::AST() {
+ root = new ASTProgram();
+ current_node = root;
+ number_of_nodes = 1;
+ level_of_depth = 0;
+}
+
+AST::~AST() {
+}
+
diff --git a/Sencha-lang/AST/AST.h b/Sencha-lang/AST/AST.h
new file mode 100644
index 0000000..c29207e
--- /dev/null
+++ b/Sencha-lang/AST/AST.h
@@ -0,0 +1,23 @@
+/*
+ * AST.h
+ *
+ * Created on: Nov 4, 2012
+ * Author: attero
+ */
+
+#ifndef AST_H_
+#define AST_H_
+#include "ASTNode.h"
+
+class AST {
+public:
+ AST();
+ ASTNode * root;
+ ASTNode * current_node;
+ int number_of_nodes;
+ int level_of_depth;
+ ASTNode * add_node(ASTNode * node);
+ virtual ~AST();
+};
+
+#endif /* AST_H_ */
diff --git a/Sencha-lang/AST/ASTExpression.cpp b/Sencha-lang/AST/ASTExpression.cpp
new file mode 100644
index 0000000..32a47d8
--- /dev/null
+++ b/Sencha-lang/AST/ASTExpression.cpp
@@ -0,0 +1,18 @@
+/*
+ * ASTExpression.cpp
+ *
+ * Created on: Nov 4, 2012
+ * Author: attero
+ */
+
+#include "ASTExpression.h"
+
+ASTExpression::ASTExpression() {
+ // TODO Auto-generated constructor stub
+
+}
+
+ASTExpression::~ASTExpression() {
+ // TODO Auto-generated destructor stub
+}
+
diff --git a/Sencha-lang/AST/ASTExpression.h b/Sencha-lang/AST/ASTExpression.h
new file mode 100644
index 0000000..69010ae
--- /dev/null
+++ b/Sencha-lang/AST/ASTExpression.h
@@ -0,0 +1,18 @@
+/*
+ * ASTExpression.h
+ *
+ * Created on: Nov 4, 2012
+ * Author: attero
+ */
+
+#ifndef ASTEXPRESSION_H_
+#define ASTEXPRESSION_H_
+#include "ASTNode.h"
+
+class ASTExpression : public ASTNode {
+public:
+ ASTExpression();
+ virtual ~ASTExpression();
+};
+
+#endif /* ASTEXPRESSION_H_ */
diff --git a/Sencha-lang/AST/ASTNode.cpp b/Sencha-lang/AST/ASTNode.cpp
new file mode 100644
index 0000000..80429c2
--- /dev/null
+++ b/Sencha-lang/AST/ASTNode.cpp
@@ -0,0 +1,18 @@
+/*
+ * ASTNode.cpp
+ *
+ * Created on: Nov 4, 2012
+ * Author: attero
+ */
+
+#include "ASTNode.h"
+
+ASTNode::ASTNode() {
+ // TODO Auto-generated constructor stub
+ parent = 0;
+}
+
+ASTNode::~ASTNode() {
+ // TODO Auto-generated destructor stub
+}
+
diff --git a/Sencha-lang/AST/ASTNode.h b/Sencha-lang/AST/ASTNode.h
new file mode 100644
index 0000000..b0145a3
--- /dev/null
+++ b/Sencha-lang/AST/ASTNode.h
@@ -0,0 +1,24 @@
+/*
+ * ASTNode.h
+ *
+ * Created on: Nov 4, 2012
+ * Author: attero
+ */
+
+#ifndef ASTNODE_H_
+#define ASTNODE_H_
+#include <vector>
+
+class ASTNode {
+public:
+ ASTNode();
+ ASTNode * parent;
+ std::vector<ASTNode *> children;
+ void add_children(ASTNode *);
+ void remove_most_right_children();
+ void set_parent(ASTNode *);
+ virtual void execute() = 0;
+ virtual ~ASTNode();
+};
+
+#endif /* ASTNODE_H_ */
diff --git a/Sencha-lang/AST/ASTPrimary.cpp b/Sencha-lang/AST/ASTPrimary.cpp
new file mode 100644
index 0000000..c442ec5
--- /dev/null
+++ b/Sencha-lang/AST/ASTPrimary.cpp
@@ -0,0 +1,20 @@
+/*
+ * ASTPrimary.cpp
+ *
+ * Created on: Nov 4, 2012
+ * Author: attero
+ */
+
+#include "ASTPrimary.h"
+
+ASTPrimary::ASTPrimary(ASTNode * parent) {
+ // TODO Auto-generated constructor stub
+ value = "";
+ this->parent = parent;
+}
+
+ASTPrimary::~ASTPrimary() {
+ // TODO Auto-generated destructor stub
+}
+
+
diff --git a/Sencha-lang/AST/ASTPrimary.h b/Sencha-lang/AST/ASTPrimary.h
new file mode 100644
index 0000000..9387a0a
--- /dev/null
+++ b/Sencha-lang/AST/ASTPrimary.h
@@ -0,0 +1,23 @@
+/*
+ * ASTPrimary.h
+ *
+ * Created on: Nov 4, 2012
+ * Author: attero
+ */
+
+#ifndef ASTPRIMARY_H_
+#define ASTPRIMARY_H_
+#include "ASTNode.h"
+#include <string>
+
+class ASTPrimary : public ASTNode {
+public:
+ ASTPrimary(ASTNode * parent);
+
+ virtual ~ASTPrimary();
+ virtual void execute() {};
+ std::string value;
+
+};
+
+#endif /* ASTPRIMARY_H_ */
diff --git a/Sencha-lang/AST/ASTProgram.cpp b/Sencha-lang/AST/ASTProgram.cpp
new file mode 100644
index 0000000..8b74923
--- /dev/null
+++ b/Sencha-lang/AST/ASTProgram.cpp
@@ -0,0 +1,21 @@
+/*
+ * ASTProgram.cpp
+ *
+ * Created on: Nov 5, 2012
+ * Author: attero
+ */
+
+#include "ASTProgram.h"
+
+ASTProgram::ASTProgram() {
+ // TODO Auto-generated constructor stub
+
+}
+
+ASTProgram::~ASTProgram() {
+ // TODO Auto-generated destructor stub
+}
+
+void ASTProgram::execute() {
+ std::cout << "Program started!\n";
+}
diff --git a/Sencha-lang/AST/ASTProgram.h b/Sencha-lang/AST/ASTProgram.h
new file mode 100644
index 0000000..f83bbf3
--- /dev/null
+++ b/Sencha-lang/AST/ASTProgram.h
@@ -0,0 +1,22 @@
+/*
+ * ASTProgram.h
+ *
+ * Created on: Nov 5, 2012
+ * Author: attero
+ */
+
+#ifndef ASTPROGRAM_H_
+#define ASTPROGRAM_H_
+#include <iostream>
+#include "ASTNode.h"
+#include "ASTStatement.h"
+
+class ASTProgram : public ASTNode {
+public:
+ ASTProgram();
+ ASTStatement * add_child(ASTStatement * node);
+ virtual ~ASTProgram();
+ virtual void execute();
+};
+
+#endif /* ASTPROGRAM_H_ */
diff --git a/Sencha-lang/AST/ASTStatement.cpp b/Sencha-lang/AST/ASTStatement.cpp
new file mode 100644
index 0000000..52c5526
--- /dev/null
+++ b/Sencha-lang/AST/ASTStatement.cpp
@@ -0,0 +1,18 @@
+/*
+ * ASTStatement.cpp
+ *
+ * Created on: Nov 4, 2012
+ * Author: attero
+ */
+
+#include "ASTStatement.h"
+
+ASTStatement::ASTStatement() {
+ // TODO Auto-generated constructor stub
+
+}
+
+ASTStatement::~ASTStatement() {
+ // TODO Auto-generated destructor stub
+}
+
diff --git a/Sencha-lang/AST/ASTStatement.h b/Sencha-lang/AST/ASTStatement.h
new file mode 100644
index 0000000..b2bfd84
--- /dev/null
+++ b/Sencha-lang/AST/ASTStatement.h
@@ -0,0 +1,18 @@
+/*
+ * ASTStatement.h
+ *
+ * Created on: Nov 4, 2012
+ * Author: attero
+ */
+
+#ifndef ASTSTATEMENT_H_
+#define ASTSTATEMENT_H_
+#include "ASTNode.h"
+
+class ASTStatement : public ASTNode {
+public:
+ ASTStatement();
+ virtual ~ASTStatement();
+};
+
+#endif /* ASTSTATEMENT_H_ */
diff --git a/Sencha-lang/AST/AllTypesOfASTNodes.h b/Sencha-lang/AST/AllTypesOfASTNodes.h
new file mode 100644
index 0000000..61051e6
--- /dev/null
+++ b/Sencha-lang/AST/AllTypesOfASTNodes.h
@@ -0,0 +1,20 @@
+/*
+ * AllTypesOfASTNodes.h
+ *
+ * Created on: Nov 5, 2012
+ * Author: attero
+ */
+
+#ifndef ALLTYPESOFASTNODES_H_
+#define ALLTYPESOFASTNODES_H_
+
+#include "ASTNode.h"
+#include "ASTProgram.h"
+#include "ASTStatement.h"
+#include "ASTExpression.h"
+#include "ASTPrimary.h"
+
+//And probably more
+//TODO actualize it
+
+#endif /* ALLTYPESOFASTNODES_H_ */