[Avida-SVN] r1758 - in development: Avida.xcodeproj source/script
brysonda at myxo.css.msu.edu
brysonda at myxo.css.msu.edu
Fri Jul 6 15:03:23 PDT 2007
Author: brysonda
Date: 2007-07-06 18:03:23 -0400 (Fri, 06 Jul 2007)
New Revision: 1758
Modified:
development/Avida.xcodeproj/project.pbxproj
development/source/script/ASTree.cc
development/source/script/ASTree.h
development/source/script/cParser.cc
Log:
AS: Stub a few AST classes.
Modified: development/Avida.xcodeproj/project.pbxproj
===================================================================
--- development/Avida.xcodeproj/project.pbxproj 2007-07-06 18:58:57 UTC (rev 1757)
+++ development/Avida.xcodeproj/project.pbxproj 2007-07-06 22:03:23 UTC (rev 1758)
@@ -772,7 +772,7 @@
70DCAC77097AF730002F8733 /* key_chart */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = key_chart; sourceTree = "<group>"; };
70DCAC78097AF730002F8733 /* viewer.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = viewer.cc; sourceTree = "<group>"; };
70DCAC9B097AF7C0002F8733 /* primitive.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = primitive.cc; sourceTree = "<group>"; };
- 70DCAD1C097AF7CC002F8733 /* avida-s */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "avida-s"; sourceTree = BUILT_PRODUCTS_DIR; };
+ 70DCAD1C097AF7CC002F8733 /* avida-s */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = "compiled.mach-o.executable"; path = "avida-s"; sourceTree = BUILT_PRODUCTS_DIR; };
70DCAD1F097AF81A002F8733 /* AvidaScript.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = AvidaScript.h; sourceTree = "<group>"; };
70DCAD20097AF81A002F8733 /* cLexer.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cLexer.h; sourceTree = "<group>"; };
70DCAD21097AF81A002F8733 /* cLexer.l */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.lex; path = cLexer.l; sourceTree = "<group>"; };
Modified: development/source/script/ASTree.cc
===================================================================
--- development/source/script/ASTree.cc 2007-07-06 18:58:57 UTC (rev 1757)
+++ development/source/script/ASTree.cc 2007-07-06 22:03:23 UTC (rev 1758)
@@ -24,3 +24,24 @@
#include "ASTree.h"
+
+void cASTExpressionUnary::Accept(cASTVisitor& visitor)
+{
+
+}
+
+void cASTExpressionBinary::Accept(cASTVisitor& visitor)
+{
+
+}
+
+void cASTLiteral::Accept(cASTVisitor& visitor)
+{
+
+}
+
+void cASTFunctionCall::Accept(cASTVisitor& visitor)
+{
+
+}
+
Modified: development/source/script/ASTree.h
===================================================================
--- development/source/script/ASTree.h 2007-07-06 18:58:57 UTC (rev 1757)
+++ development/source/script/ASTree.h 2007-07-06 22:03:23 UTC (rev 1758)
@@ -25,36 +25,85 @@
#ifndef ASTree_h
#define ASTree_h
-enum eASTNodeType
-{
- N_STMT_LIST,
- N_EXPR,
- N_VAR_DECL,
- N_IF_BLOCK,
- N_WHILE_BLOCK,
- N_FOREACH_BLOCK,
- N_FUNC,
- N_RETURN,
- N_BLOCK,
-
- N_ERROR
-};
+#ifndef AvidaScript_h
+#include "AvidaScript.h"
+#endif
+#ifndef defs_h
+#include "defs.h"
+#endif
+
class cASTVisitor;
+
class cASTNode
{
+private:
+ cASTNode(const cASTNode&); // @not_implemented
+ cASTNode& operator=(const cASTNode&); // @not_implmented
+
+protected:
+ cASTNode() { ; }
+
public:
- eASTNodeType type;
-
- cASTNode() { ; }
virtual ~cASTNode() { ; }
virtual void Accept(cASTVisitor& visitor) = 0;
};
+class cASTExpressionUnary : public cASTNode
+{
+private:
+ ASToken_t m_op;
+ cASTNode* m_expr;
+
+public:
+ cASTExpressionUnary(ASToken_t op) : m_op(op), m_expr(NULL) { ; }
+
+ void SetExpression(cASTNode* expr) { m_expr = expr; }
+
+ void Accept(cASTVisitor& visitor);
+};
+class cASTExpressionBinary : public cASTNode
+{
+private:
+ ASToken_t m_op;
+ cASTNode* m_left;
+ cASTNode* m_right;
+
+public:
+ cASTExpressionBinary(ASToken_t op) : m_op(op), m_left(NULL), m_right(NULL) { ; }
+
+ void SetLeft(cASTNode* left) { m_left = left; }
+ void SetRight(cASTNode* right) { m_right = right; }
+
+ void Accept(cASTVisitor& visitor);
+};
+class cASTLiteral : public cASTNode
+{
+private:
+ ASToken_t m_type;
+
+public:
+ cASTLiteral(ASToken_t t) : m_type(t) { ; }
+
+ void Accept(cASTVisitor& visitor);
+};
+
+
+class cASTFunctionCall : public cASTNode
+{
+private:
+
+public:
+ cASTFunctionCall() { ; }
+
+ void Accept(cASTVisitor& visitor);
+};
+
+
#endif
Modified: development/source/script/cParser.cc
===================================================================
--- development/source/script/cParser.cc 2007-07-06 18:58:57 UTC (rev 1757)
+++ development/source/script/cParser.cc 2007-07-06 22:03:23 UTC (rev 1758)
@@ -507,10 +507,8 @@
case FLOAT:
case INT:
case CHAR:
- // @todo - expr = ;
- break;
case STRING:
- // @todo - expr = ;
+ expr = new cASTLiteral(currentToken());
break;
case ID:
if (peekToken() == PREC_OPEN) {
More information about the Avida-cvs
mailing list