1
0

とりあえず構文木を一部作るようにして計算させた

This commit is contained in:
otya128
2015-06-03 20:59:47 +09:00
parent a74268b59a
commit bb9ae9abdc
4 changed files with 117 additions and 8 deletions

View File

@@ -3,7 +3,7 @@ import otya.smilebasic.type;
import otya.smilebasic.token;
enum NodeType
{
Node = 0b1,
Node,
Expression,
Constant,
BinaryOperator,
@@ -20,6 +20,7 @@ class Constant : Expression
Value value;
this(Value v)
{
this.type = NodeType.Constant;
this.value = v;
}
}
@@ -28,6 +29,12 @@ class BinaryOperator : Expression
Expression item1;
TokenType operator;
Expression item2;
this(Expression i1, TokenType o)
{
this.type = NodeType.BinaryOperator;
this.item1 = i1;
this.operator = o;
}
this(Expression i1, TokenType o, Expression i2)
{
this.type = NodeType.BinaryOperator;