AST is accepting functions!!!

This commit is contained in:
SpookyDervish
2025-10-14 07:14:53 +11:00
parent f9cd1dba29
commit 518a19d3bf
9 changed files with 243 additions and 101 deletions

View File

@@ -2,17 +2,46 @@
"type": "Program",
"statements": [
{
"AssignmentStatement": {
"type": "AssignmentStatement",
"FunctionStatement": {
"type": "FunctionStatement",
"name": {
"type": "IdentifierLiteral",
"value": "myVar"
"value": "main"
},
"value": {
"type": "IntegerLiteral",
"value": 1
},
"value_type": "Bool"
"return_type": "Int",
"parameters": [],
"body": {
"type": "BlockStatement",
"statements": [
{
"type": "AssignmentStatement",
"name": {
"type": "IdentifierLiteral",
"value": "x"
},
"value": {
"type": "IntegerLiteral",
"value": 123
},
"value_type": "Int"
},
{
"type": "ReturnStatement",
"return_value": {
"type": "InfixExpression",
"left_node": {
"type": "IdentifierLiteral",
"value": "x"
},
"operator": "+",
"right_node": {
"type": "IntegerLiteral",
"value": 5
}
}
}
]
}
}
}
]