AST part moved into AST folder.

devel
Justyna Att Ilczuk 2012-11-17 17:02:32 +01:00
parent 665492878d
commit 6e376d5b1c
14 changed files with 277 additions and 7 deletions

View File

@ -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>

19
Sencha-lang/AST/AST.cpp Normal file
View File

@ -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() {
}

23
Sencha-lang/AST/AST.h Normal file
View File

@ -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_ */

View File

@ -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
}

View File

@ -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_ */

View File

@ -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
}

24
Sencha-lang/AST/ASTNode.h Normal file
View File

@ -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_ */

View File

@ -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
}

View File

@ -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_ */

View File

@ -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";
}

View File

@ -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_ */

View File

@ -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
}

View File

@ -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_ */

View File

@ -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_ */