99 lines
4.3 KiB
JSON
99 lines
4.3 KiB
JSON
{
|
|
"type": "Program",
|
|
"statements": [
|
|
{
|
|
"FunctionStatement": {
|
|
"type": "FunctionStatement",
|
|
"name": {
|
|
"type": "IdentifierLiteral",
|
|
"value": "main"
|
|
},
|
|
"return_type": "Int",
|
|
"parameters": [],
|
|
"body": {
|
|
"type": "BlockStatement",
|
|
"statements": [
|
|
{
|
|
"type": "AssignmentStatement",
|
|
"name": {
|
|
"type": "IdentifierLiteral",
|
|
"value": "a"
|
|
},
|
|
"value": {
|
|
"type": "IntegerLiteral",
|
|
"value": 0
|
|
},
|
|
"value_type": "Int"
|
|
},
|
|
{
|
|
"type": "WhileStatement",
|
|
"condition": {
|
|
"type": "InfixExpression",
|
|
"left_node": {
|
|
"type": "IdentifierLiteral",
|
|
"value": "a"
|
|
},
|
|
"operator": "<",
|
|
"right_node": {
|
|
"type": "IntegerLiteral",
|
|
"value": 10
|
|
}
|
|
},
|
|
"body": {
|
|
"type": "BlockStatement",
|
|
"statements": [
|
|
{
|
|
"type": "ExpressionStatement",
|
|
"expr": {
|
|
"type": "CallExpression",
|
|
"function": {
|
|
"type": "IdentifierLiteral",
|
|
"value": "print"
|
|
},
|
|
"arguments": [
|
|
{
|
|
"type": "StringLiteral",
|
|
"value": "a = %i\\n"
|
|
},
|
|
{
|
|
"type": "IdentifierLiteral",
|
|
"value": "a"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"type": "ReassignStatement",
|
|
"ident": {
|
|
"type": "IdentifierLiteral",
|
|
"value": "a"
|
|
},
|
|
"right_value": {
|
|
"type": "InfixExpression",
|
|
"left_node": {
|
|
"type": "IdentifierLiteral",
|
|
"value": "a"
|
|
},
|
|
"operator": "+",
|
|
"right_node": {
|
|
"type": "IntegerLiteral",
|
|
"value": 1
|
|
}
|
|
}
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"type": "ReturnStatement",
|
|
"return_value": {
|
|
"type": "IdentifierLiteral",
|
|
"value": "a"
|
|
}
|
|
}
|
|
]
|
|
}
|
|
}
|
|
}
|
|
]
|
|
} |