FOR STATEMENTS WORK!!!!!
This commit is contained in:
@@ -14,29 +14,29 @@
|
||||
"type": "BlockStatement",
|
||||
"statements": [
|
||||
{
|
||||
"type": "AssignmentStatement",
|
||||
"name": {
|
||||
"type": "IdentifierLiteral",
|
||||
"value": "a"
|
||||
"type": "ForStatement",
|
||||
"var_declaration": {
|
||||
"type": "AssignmentStatement",
|
||||
"name": {
|
||||
"type": "IdentifierLiteral",
|
||||
"value": "x"
|
||||
},
|
||||
"value": {
|
||||
"type": "IntegerLiteral",
|
||||
"value": 1
|
||||
},
|
||||
"value_type": "Int"
|
||||
},
|
||||
"value": {
|
||||
"type": "IntegerLiteral",
|
||||
"value": 0
|
||||
},
|
||||
"value_type": "Int"
|
||||
},
|
||||
{
|
||||
"type": "WhileStatement",
|
||||
"condition": {
|
||||
"type": "InfixExpression",
|
||||
"left_node": {
|
||||
"type": "IdentifierLiteral",
|
||||
"value": "a"
|
||||
"value": "x"
|
||||
},
|
||||
"operator": "<",
|
||||
"operator": "<=",
|
||||
"right_node": {
|
||||
"type": "IntegerLiteral",
|
||||
"value": 10
|
||||
"value": 20
|
||||
}
|
||||
},
|
||||
"body": {
|
||||
@@ -53,33 +53,14 @@
|
||||
"arguments": [
|
||||
{
|
||||
"type": "StringLiteral",
|
||||
"value": "a = %i\\n"
|
||||
"value": "i = %i\\n"
|
||||
},
|
||||
{
|
||||
"type": "IdentifierLiteral",
|
||||
"value": "a"
|
||||
"value": "x"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "ReassignStatement",
|
||||
"ident": {
|
||||
"type": "IdentifierLiteral",
|
||||
"value": "a"
|
||||
},
|
||||
"right_value": {
|
||||
"type": "InfixExpression",
|
||||
"left_node": {
|
||||
"type": "IdentifierLiteral",
|
||||
"value": "a"
|
||||
},
|
||||
"operator": "+",
|
||||
"right_node": {
|
||||
"type": "IntegerLiteral",
|
||||
"value": 1
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -88,7 +69,7 @@
|
||||
"type": "ReturnStatement",
|
||||
"return_value": {
|
||||
"type": "IdentifierLiteral",
|
||||
"value": "a"
|
||||
"value": "x"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user