1
0
This commit is contained in:
otya128
2015-06-03 19:51:42 +09:00
parent fb28e1236d
commit 6673ca3fc2
7 changed files with 449 additions and 0 deletions

38
SMILEBASIC/node.d Normal file
View File

@@ -0,0 +1,38 @@
module otya.smilebasic.node;
import otya.smilebasic.type;
import otya.smilebasic.token;
enum NodeType
{
Node = 0b1,
Expression,
Constant,
BinaryOperator,
}
abstract class Node
{
NodeType type;
}
abstract class Expression : Node
{
}
class Constant : Expression
{
Value value;
this(Value v)
{
this.value = v;
}
}
class BinaryOperator : Expression
{
Expression item1;
TokenType operator;
Expression item2;
this(Expression i1, TokenType o, Expression i2)
{
this.type = NodeType.BinaryOperator;
this.item1 = i1;
this.operator = o;
this.item2 = i2;
}
}