1
0

FORを実�

This commit is contained in:
otya128
2015-06-07 13:28:19 +09:00
parent 46b7b2ede3
commit 65fe8558a2
6 changed files with 243 additions and 5 deletions

View File

@@ -21,6 +21,7 @@ enum NodeType
Label,
Goto,
If,
For,
}
abstract class Node
{
@@ -209,3 +210,26 @@ class If : Statement
return !(else_ is null) && else_.statements.length != 0;
}
}
class For : Statement
{
Assign initExpression;
Expression toExpression;
Expression stepExpression;
Statements statements;
this(Assign assign, Expression toExpression, Expression stepExpression, Statements statements)
{
this.type = NodeType.For;
this.initExpression = assign;
this.toExpression = toExpression;
this.stepExpression = stepExpression;
this.statements = statements;
}
this(Assign assign, Expression toExpression, Statements statements)
{
this.type = NodeType.For;
this.initExpression = assign;
this.toExpression = toExpression;
this.stepExpression = null;
this.statements = statements;
}
}