2025-10-15 06:59:29 +11:00
|
|
|
{
|
|
|
|
|
"type": "Program",
|
|
|
|
|
"statements": [
|
|
|
|
|
{
|
|
|
|
|
"FunctionStatement": {
|
|
|
|
|
"type": "FunctionStatement",
|
|
|
|
|
"name": {
|
|
|
|
|
"type": "IdentifierLiteral",
|
2025-10-15 07:16:15 +11:00
|
|
|
"value": "add"
|
2025-10-15 06:59:29 +11:00
|
|
|
},
|
|
|
|
|
"return_type": "Int",
|
2025-10-15 07:16:15 +11:00
|
|
|
"parameters": [
|
|
|
|
|
{
|
|
|
|
|
"type": "FunctionParameter",
|
|
|
|
|
"name": "a",
|
|
|
|
|
"value_type": "Int"
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"type": "FunctionParameter",
|
|
|
|
|
"name": "b",
|
|
|
|
|
"value_type": "Int"
|
|
|
|
|
}
|
|
|
|
|
],
|
2025-10-15 06:59:29 +11:00
|
|
|
"body": {
|
|
|
|
|
"type": "BlockStatement",
|
|
|
|
|
"statements": [
|
|
|
|
|
{
|
|
|
|
|
"type": "ReturnStatement",
|
|
|
|
|
"return_value": {
|
2025-10-15 07:16:15 +11:00
|
|
|
"type": "InfixExpression",
|
|
|
|
|
"left_node": {
|
|
|
|
|
"type": "IdentifierLiteral",
|
|
|
|
|
"value": "a"
|
|
|
|
|
},
|
|
|
|
|
"operator": "+",
|
|
|
|
|
"right_node": {
|
|
|
|
|
"type": "IdentifierLiteral",
|
|
|
|
|
"value": "b"
|
|
|
|
|
}
|
2025-10-15 06:59:29 +11:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"FunctionStatement": {
|
|
|
|
|
"type": "FunctionStatement",
|
|
|
|
|
"name": {
|
|
|
|
|
"type": "IdentifierLiteral",
|
|
|
|
|
"value": "main"
|
|
|
|
|
},
|
|
|
|
|
"return_type": "Int",
|
|
|
|
|
"parameters": [],
|
|
|
|
|
"body": {
|
|
|
|
|
"type": "BlockStatement",
|
|
|
|
|
"statements": [
|
|
|
|
|
{
|
2025-10-15 16:23:51 +11:00
|
|
|
"type": "ExpressionStatement",
|
|
|
|
|
"expr": {
|
2025-10-15 06:59:29 +11:00
|
|
|
"type": "CallExpression",
|
|
|
|
|
"function": {
|
|
|
|
|
"type": "IdentifierLiteral",
|
2025-10-15 16:23:51 +11:00
|
|
|
"value": "print"
|
2025-10-15 06:59:29 +11:00
|
|
|
},
|
2025-10-15 07:16:15 +11:00
|
|
|
"arguments": [
|
|
|
|
|
{
|
2025-10-15 16:23:51 +11:00
|
|
|
"type": "StringLiteral",
|
|
|
|
|
"value": "apples %i"
|
2025-10-15 07:16:15 +11:00
|
|
|
},
|
|
|
|
|
{
|
2025-10-15 16:23:51 +11:00
|
|
|
"type": "CallExpression",
|
|
|
|
|
"function": {
|
|
|
|
|
"type": "IdentifierLiteral",
|
|
|
|
|
"value": "add"
|
|
|
|
|
},
|
|
|
|
|
"arguments": [
|
|
|
|
|
{
|
|
|
|
|
"type": "IntegerLiteral",
|
|
|
|
|
"value": 1
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"type": "IntegerLiteral",
|
|
|
|
|
"value": 2
|
|
|
|
|
}
|
|
|
|
|
]
|
2025-10-15 07:16:15 +11:00
|
|
|
}
|
|
|
|
|
]
|
2025-10-15 06:59:29 +11:00
|
|
|
}
|
2025-10-15 16:23:51 +11:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"type": "ReturnStatement",
|
|
|
|
|
"return_value": {
|
|
|
|
|
"type": "IntegerLiteral",
|
|
|
|
|
"value": 0
|
|
|
|
|
}
|
2025-10-15 06:59:29 +11:00
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|