90 lines
3.8 KiB
JSON
90 lines
3.8 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": "x"
|
|
},
|
|
"value": {
|
|
"type": "IntegerLiteral",
|
|
"value": 123
|
|
},
|
|
"value_type": "Int"
|
|
},
|
|
{
|
|
"type": "ExpressionStatement",
|
|
"expr": {
|
|
"type": "IfStatement",
|
|
"condition": {
|
|
"type": "InfixExpression",
|
|
"left_node": {
|
|
"type": "IdentifierLiteral",
|
|
"value": "x"
|
|
},
|
|
"operator": "==",
|
|
"right_node": {
|
|
"type": "IntegerLiteral",
|
|
"value": 123
|
|
}
|
|
},
|
|
"consequence": {
|
|
"type": "BlockStatement",
|
|
"statements": [
|
|
{
|
|
"type": "ReassignStatement",
|
|
"ident": {
|
|
"type": "IdentifierLiteral",
|
|
"value": "x"
|
|
},
|
|
"right_value": {
|
|
"type": "IntegerLiteral",
|
|
"value": 0
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"alternative": {
|
|
"type": "BlockStatement",
|
|
"statements": [
|
|
{
|
|
"type": "ReassignStatement",
|
|
"ident": {
|
|
"type": "IdentifierLiteral",
|
|
"value": "x"
|
|
},
|
|
"right_value": {
|
|
"type": "IntegerLiteral",
|
|
"value": 1
|
|
}
|
|
}
|
|
]
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"type": "ReturnStatement",
|
|
"return_value": {
|
|
"type": "IdentifierLiteral",
|
|
"value": "x"
|
|
}
|
|
}
|
|
]
|
|
}
|
|
}
|
|
}
|
|
]
|
|
} |