forgot about the not operator 🥀

This commit is contained in:
SpookyDervish
2025-10-14 21:30:56 +11:00
parent 3d9208f0f8
commit bf0f9a9348
4 changed files with 14 additions and 109 deletions

View File

@@ -1,90 +0,0 @@
{
"type": "Program",
"statements": [
{
"FunctionStatement": {
"type": "FunctionStatement",
"name": {
"type": "IdentifierLiteral",
"value": "main"
},
"return_type": "Int",
"parameters": [],
"body": {
"type": "BlockStatement",
"statements": [
{
"type": "AssignmentStatement",
"name": {
"type": "IdentifierLiteral",
"value": "x"
},
"value": {
"type": "IntegerLiteral",
"value": 123
},
"value_type": "Int"
},
{
"type": "ExpressionStatement",
"expr": {
"type": "IfStatement",
"condition": {
"type": "InfixExpression",
"left_node": {
"type": "IdentifierLiteral",
"value": "x"
},
"operator": "==",
"right_node": {
"type": "IntegerLiteral",
"value": 123
}
},
"consequence": {
"type": "BlockStatement",
"statements": [
{
"type": "ReassignStatement",
"ident": {
"type": "IdentifierLiteral",
"value": "x"
},
"right_value": {
"type": "IntegerLiteral",
"value": 0
}
}
]
},
"alternative": {
"type": "BlockStatement",
"statements": [
{
"type": "ReassignStatement",
"ident": {
"type": "IdentifierLiteral",
"value": "x"
},
"right_value": {
"type": "IntegerLiteral",
"value": 1
}
}
]
}
}
},
{
"type": "ReturnStatement",
"return_value": {
"type": "IdentifierLiteral",
"value": "x"
}
}
]
}
}
}
]
}

View File

@@ -7,18 +7,15 @@ target datalayout = ""
define i32 @"main"()
{
main_entry:
%".2" = alloca i32
store i32 6, i32* %".2"
%".4" = load i32, i32* %".2"
%".5" = icmp eq i32 %".4", 5
%".2" = alloca float
store float 0x4014000000000000, float* %".2"
%".4" = load float, float* %".2"
%".5" = fcmp oeq float %".4", 0x4014000000000000
br i1 %".5", label %"main_entry.if", label %"main_entry.else"
main_entry.if:
store i32 0, i32* %".2"
br label %"main_entry.endif"
ret i32 1
main_entry.else:
store i32 1, i32* %".2"
br label %"main_entry.endif"
ret i32 0
main_entry.endif:
%".11" = load i32, i32* %".2"
ret i32 %".11"
ret i32 0
}