AST works for variable reassignment
kinda coded horribly tho lol
This commit is contained in:
@@ -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
18
debug/ir.ll
Normal 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
|
||||
}
|
||||
Reference in New Issue
Block a user