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
}
}
}
]
}
}
}
]

View File

@@ -1,13 +0,0 @@
; ModuleID = "main"
target triple = "x86_64-pc-windows-msvc"
target datalayout = ""
define i32 @"main"()
{
main_entry:
%".2" = alloca float
store float 0x3ff3ae1480000000, float* %".2"
%".4" = alloca i32
store i32 456, i32* %".4"
ret i32 123
}