80 lines
3.3 KiB
JSON
80 lines
3.3 KiB
JSON
{
|
|
"type": "Program",
|
|
"statements": [
|
|
{
|
|
"FunctionStatement": {
|
|
"type": "FunctionStatement",
|
|
"name": {
|
|
"type": "IdentifierLiteral",
|
|
"value": "main"
|
|
},
|
|
"return_type": "Int",
|
|
"parameters": [],
|
|
"body": {
|
|
"type": "BlockStatement",
|
|
"statements": [
|
|
{
|
|
"type": "ForStatement",
|
|
"var_declaration": {
|
|
"type": "AssignmentStatement",
|
|
"name": {
|
|
"type": "IdentifierLiteral",
|
|
"value": "x"
|
|
},
|
|
"value": {
|
|
"type": "IntegerLiteral",
|
|
"value": 1
|
|
},
|
|
"value_type": "Int"
|
|
},
|
|
"condition": {
|
|
"type": "InfixExpression",
|
|
"left_node": {
|
|
"type": "IdentifierLiteral",
|
|
"value": "x"
|
|
},
|
|
"operator": "<=",
|
|
"right_node": {
|
|
"type": "IntegerLiteral",
|
|
"value": 20
|
|
}
|
|
},
|
|
"body": {
|
|
"type": "BlockStatement",
|
|
"statements": [
|
|
{
|
|
"type": "ExpressionStatement",
|
|
"expr": {
|
|
"type": "CallExpression",
|
|
"function": {
|
|
"type": "IdentifierLiteral",
|
|
"value": "print"
|
|
},
|
|
"arguments": [
|
|
{
|
|
"type": "StringLiteral",
|
|
"value": "i = %i\\n"
|
|
},
|
|
{
|
|
"type": "IdentifierLiteral",
|
|
"value": "x"
|
|
}
|
|
]
|
|
}
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"type": "ReturnStatement",
|
|
"return_value": {
|
|
"type": "IdentifierLiteral",
|
|
"value": "x"
|
|
}
|
|
}
|
|
]
|
|
}
|
|
}
|
|
}
|
|
]
|
|
} |