とりあえず構文木を一部作るようにして計算させた
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user