feat: execute source control flow and exact real arithmetic

This commit is contained in:
2026-11-12 10:48:27 +08:00
parent f3e1670c58
commit 5ff1c68f5f
28 changed files with 1045 additions and 117 deletions
+91 -3
View File
@@ -1,6 +1,6 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "urn:endor:ast:sha256:c7c10c6a61158810fa55044f1aa79f3558ac18ca3be59cbf7f2499b5add8df5b",
"$id": "urn:endor:ast:sha256:21b0349ac295d9bc8cedcad8f07d8e2d45cf220e19e7c2fad10269555fcfd71a",
"$ref": "#/$defs/AstDocument",
"$defs": {
"Span": {
@@ -27,7 +27,7 @@
"type": "object",
"properties": {
"schema": {
"const": "urn:endor:ast:sha256:c7c10c6a61158810fa55044f1aa79f3558ac18ca3be59cbf7f2499b5add8df5b"
"const": "urn:endor:ast:sha256:21b0349ac295d9bc8cedcad8f07d8e2d45cf220e19e7c2fad10269555fcfd71a"
},
"root": {
"$ref": "#/$defs/AstRoot"
@@ -354,6 +354,38 @@
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"kind": {
"const": "If"
},
"data": {
"$ref": "#/$defs/IfStatement"
}
},
"required": [
"kind",
"data"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"kind": {
"const": "While"
},
"data": {
"$ref": "#/$defs/WhileStatement"
}
},
"required": [
"kind",
"data"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
@@ -468,6 +500,56 @@
],
"additionalProperties": false
},
"IfStatement": {
"type": "object",
"properties": {
"condition": {
"$ref": "#/$defs/Expr"
},
"body": {
"$ref": "#/$defs/Block"
},
"otherwise": {
"anyOf": [
{
"$ref": "#/$defs/Block"
},
{
"type": "null"
}
]
},
"span": {
"$ref": "#/$defs/Span"
}
},
"required": [
"condition",
"body",
"span"
],
"additionalProperties": false
},
"WhileStatement": {
"type": "object",
"properties": {
"condition": {
"$ref": "#/$defs/Expr"
},
"body": {
"$ref": "#/$defs/Block"
},
"span": {
"$ref": "#/$defs/Span"
}
},
"required": [
"condition",
"body",
"span"
],
"additionalProperties": false
},
"ReturnStatement": {
"type": "object",
"properties": {
@@ -742,7 +824,13 @@
"Add",
"Subtract",
"Multiply",
"Divide"
"Divide",
"Equal",
"NotEqual",
"Less",
"LessEqual",
"Greater",
"GreaterEqual"
]
}
}