110 lines
2.0 KiB
C++
110 lines
2.0 KiB
C++
|
|
#ifndef NODE_H
|
|
#define NODE_H NODE_H
|
|
|
|
#include <stdio.h>
|
|
#include <stdint.h>
|
|
#include <vector>
|
|
#include <string>
|
|
#include "util/refptr.h"
|
|
#include "main/Compiler.h"
|
|
|
|
class Node
|
|
{
|
|
public:
|
|
virtual ~Node();
|
|
void addChild(refptr<Node> child) { m_children.push_back(child); }
|
|
void addChildren(refptr<Node> other);
|
|
std::vector< refptr<Node> > & getChildren() { return m_children; }
|
|
|
|
virtual double getDouble() { return m_double; }
|
|
virtual uint64_t getInteger() { return m_integer; }
|
|
virtual std::string getString() { return m_string; }
|
|
virtual void process(refptr<Compiler> compiler);
|
|
|
|
protected:
|
|
std::vector< refptr<Node> > m_children;
|
|
uint64_t m_integer;
|
|
std::string m_string;
|
|
double m_double;
|
|
};
|
|
|
|
|
|
class ArrayTypeNode : public Node
|
|
{
|
|
};
|
|
|
|
class AssignExprNode : public Node
|
|
{
|
|
};
|
|
|
|
class CStatementNode : public Node
|
|
{
|
|
public:
|
|
CStatementNode(const std::string & str) { m_string = str; }
|
|
virtual void process(refptr<Compiler> compiler);
|
|
};
|
|
|
|
class DoubleNode : public Node
|
|
{
|
|
public:
|
|
DoubleNode(double val) { m_double = val; }
|
|
};
|
|
|
|
class FunctionNode : public Node
|
|
{
|
|
public:
|
|
void process(refptr<Compiler> compiler);
|
|
};
|
|
|
|
class IdentifierNode : public Node
|
|
{
|
|
public:
|
|
IdentifierNode(const std::string & str) { m_string = str; }
|
|
};
|
|
|
|
class IntegerNode : public Node
|
|
{
|
|
public:
|
|
IntegerNode(uint64_t integer) { m_integer = integer; }
|
|
};
|
|
|
|
class ItemsNode : public Node
|
|
{
|
|
};
|
|
|
|
class LValueNode : public Node
|
|
{
|
|
};
|
|
|
|
class PrimitiveTypeNode : public Node
|
|
{
|
|
public:
|
|
PrimitiveTypeNode(uint64_t type) { m_integer = type; }
|
|
virtual std::string getString();
|
|
};
|
|
|
|
class ProgramNode : public Node
|
|
{
|
|
};
|
|
|
|
class ReturnStatementNode : public Node
|
|
{
|
|
};
|
|
|
|
class StringNode : public Node
|
|
{
|
|
public:
|
|
StringNode(const std::string & str) { m_string = str; }
|
|
};
|
|
|
|
class StructTypeNode : public Node
|
|
{
|
|
};
|
|
|
|
class VariableSpecNode : public Node
|
|
{
|
|
};
|
|
|
|
#endif
|