More stuff! Tons of stuff!

This commit is contained in:
Markus Hauschild
2013-06-01 00:16:38 +02:00
parent 28ca85b94e
commit a778d524b1
11 changed files with 111 additions and 11 deletions

View File

@@ -1,7 +1,7 @@
#ifndef ASTELEMENT_H
#define ASTELEMENT_H
#include "AST/ASTVisitor.h"
class ASTVisitor;
class ASTElement {
public:

View File

@@ -1,10 +1,14 @@
#ifndef ASTVISITOR_H
#define ASTVISITOR_H
#include "VariableDefinition.h"
class ASTVisitor {
public:
ASTVisitor();
virtual ~ASTVisitor();
virtual void visit(VariableDefinition* e) = 0;
};
#endif // ASTVISITOR_H

14
inc/AST/Statement.h Normal file
View File

@@ -0,0 +1,14 @@
#ifndef STATEMENT_H
#define STATEMENT_H
#include "AST/ASTElement.h"
class Statement : public ASTElement {
public:
Statement();
virtual ~Statement();
virtual void accept(ASTVisitor* visitor) = 0;
};
#endif // STATEMENT_H

16
inc/AST/Type.h Normal file
View File

@@ -0,0 +1,16 @@
#ifndef TYPE_H
#define TYPE_H
#include <string>
class Type {
public:
Type(std::string name);
~Type();
std::string getName();
private:
std::string name_;
};
#endif // TYPE_H

View File

@@ -0,0 +1,25 @@
#ifndef VARIABLEDEFINITION_H
#define VARIABLEDEFINITION_H
#include <string>
#include "AST/Statement.h"
class VariableDefinition : public Statement
{
public:
VariableDefinition(int type, std::string name);
virtual ~VariableDefinition();
virtual void accept(ASTVisitor* visitor);
// Type* getType();
int getType();
std::string getName();
private:
// Type* type_
int type_;
std::string name_;
};
#endif // VARIABLEDEFINITION_H