if statements work

This commit is contained in:
SpookyDervish
2025-10-14 21:23:11 +11:00
parent 48e7488a63
commit 3d9208f0f8
7 changed files with 256 additions and 34 deletions

View File

@@ -21,26 +21,57 @@
},
"value": {
"type": "IntegerLiteral",
"value": 0
"value": 123
},
"value_type": "Int"
},
{
"type": "ReassignStatement",
"ident": {
"type": "IdentifierLiteral",
"value": "x"
},
"right_value": {
"type": "InfixExpression",
"left_node": {
"type": "IdentifierLiteral",
"value": "x"
"type": "ExpressionStatement",
"expr": {
"type": "IfStatement",
"condition": {
"type": "InfixExpression",
"left_node": {
"type": "IdentifierLiteral",
"value": "x"
},
"operator": "==",
"right_node": {
"type": "IntegerLiteral",
"value": 123
}
},
"operator": "*",
"right_node": {
"type": "IntegerLiteral",
"value": 2
"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
}
}
]
}
}
},