AST works for variable reassignment

kinda coded horribly tho lol
This commit is contained in:
SpookyDervish
2025-10-14 19:22:59 +11:00
parent 5741a48e73
commit 655e5d1d12
7 changed files with 132 additions and 39 deletions

View File

@@ -21,24 +21,35 @@
},
"value": {
"type": "IntegerLiteral",
"value": 123
"value": 0
},
"value_type": "Int"
},
{
"type": "ReturnStatement",
"return_value": {
"type": "ReassignStatement",
"ident": {
"type": "IdentifierLiteral",
"value": "x"
},
"right_value": {
"type": "InfixExpression",
"left_node": {
"type": "IdentifierLiteral",
"value": "x"
},
"operator": "+",
"operator": "*",
"right_node": {
"type": "IntegerLiteral",
"value": 5
"value": 2
}
}
},
{
"type": "ReturnStatement",
"return_value": {
"type": "IdentifierLiteral",
"value": "x"
}
}
]
}

18
debug/ir.ll Normal file
View File

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