|
@@ -1,11 +1,11 @@
|
|
|
# Design — ISO exceptions for V3
|
|
# Design — ISO exceptions for V3
|
|
|
|
|
|
|
|
-**Status: design + M1 parser/AST + M2 runtime/codegen (2026-10-23).**
|
|
|
|
|
-`EXCEPT`/`RETRY` codegen, the handler stack, `SYSTEM.THROW`, `RETURN`
|
|
|
|
|
-unwinding and basic signal mapping are implemented. `EXCEPTIONS` and
|
|
|
|
|
-`M2EXCEPTION` (M3) are still missing. Baseline: `v3-packedset`; suite
|
|
|
|
|
-**271/271**, fixpoint OK **4,108,488 bytes**, corpus **512/612**
|
|
|
|
|
-compile-OK, 0 crashes.
|
|
|
|
|
|
|
+**Status: design + M1 parser/AST + M2 runtime/codegen + M3 libraries
|
|
|
|
|
+(2026-10-23).** `EXCEPT`/`RETRY`, the handler stack, `SYSTEM.THROW`,
|
|
|
|
|
+`EXCEPTIONS`, `M2EXCEPTION`, `RETURN` unwinding and basic signal
|
|
|
|
|
+mapping are implemented. Compiler-emitted range/index/CASE traps (M4)
|
|
|
|
|
+remain. Baseline: `v3-packedset`; suite **272/272**, fixpoint OK
|
|
|
|
|
+**4,108,488 bytes**, corpus **512/612** compile-OK, 0 crashes.
|
|
|
|
|
|
|
|
The handoff calls this the largest remaining language feature. This
|
|
The handoff calls this the largest remaining language feature. This
|
|
|
document fixes the syntax, AST, runtime model, code-generation contract,
|
|
document fixes the syntax, AST, runtime model, code-generation contract,
|
|
@@ -556,7 +556,7 @@ location"`, `"divide by zero"`.
|
|
|
|
|
|
|
|
### 9.1 Unit / regression tests
|
|
### 9.1 Unit / regression tests
|
|
|
|
|
|
|
|
-Implemented in M1/M2 (`compiler/run_tests.sh`):
|
|
|
|
|
|
|
+Implemented in M1–M3 (`compiler/run_tests.sh`):
|
|
|
|
|
|
|
|
- `t_except_parse`: EXCEPT on procedure and module bodies; handlers are
|
|
- `t_except_parse`: EXCEPT on procedure and module bodies; handlers are
|
|
|
skipped when the body completes normally.
|
|
skipped when the body completes normally.
|
|
@@ -569,17 +569,17 @@ Implemented in M1/M2 (`compiler/run_tests.sh`):
|
|
|
- `t_except_module`: program-module body `EXCEPT`/`RETRY`.
|
|
- `t_except_module`: program-module body `EXCEPT`/`RETRY`.
|
|
|
- `t_except_signal`: NIL dereference maps to `invalidLocation`; handler
|
|
- `t_except_signal`: NIL dereference maps to `invalidLocation`; handler
|
|
|
retries.
|
|
retries.
|
|
|
|
|
+- `t_except_lib`: `EXCEPTIONS`/`M2EXCEPTION` `RAISE`, `CurrentNumber`,
|
|
|
|
|
+ `GetMessage`, `IsCurrentSource`, `IsExceptionalExecution`,
|
|
|
|
|
+ wrong-source `exException`, and `M2Exception` via `SYSTEM.THROW`.
|
|
|
- `t_retry_bad`: `RETRY` outside `EXCEPT` rejected with `237`.
|
|
- `t_retry_bad`: `RETRY` outside `EXCEPT` rejected with `237`.
|
|
|
|
|
|
|
|
Still planned:
|
|
Still planned:
|
|
|
|
|
|
|
|
-- `t_except_basic`: `RAISE` from a nested procedure, handler checks
|
|
|
|
|
- `CurrentNumber`, `GetMessage`, `IsCurrentSource`,
|
|
|
|
|
- `IsExceptionalExecution`.
|
|
|
|
|
|
|
+- `t_except_basic`: a dedicated nested-handler state-restoration test
|
|
|
|
|
+ (the current `t_except_lib` covers the public queries).
|
|
|
- `t_except_trap`: integer divide-by-zero and `CASE`/range traps.
|
|
- `t_except_trap`: integer divide-by-zero and `CASE`/range traps.
|
|
|
- `t_except_unhandled`: expect_trap (rc=134).
|
|
- `t_except_unhandled`: expect_trap (rc=134).
|
|
|
-- `t_except_lib`: `EXCEPTIONS` source allocation and wrong-source
|
|
|
|
|
- `CurrentNumber` raises `exException`.
|
|
|
|
|
|
|
|
|
|
Use `expect_run_files` with:
|
|
Use `expect_run_files` with:
|
|
|
|
|
|
|
@@ -611,7 +611,7 @@ cd .. && TMP="$PWD/.scratch/fixpoint" ./bootstrap/fixpoint.sh
|
|
|
tools/v3-corpus/corpus.sh
|
|
tools/v3-corpus/corpus.sh
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
-Current M2 gates: suite **271/271**, fixpoint OK
|
|
|
|
|
|
|
+Current M3 gates: suite **272/272**, fixpoint OK
|
|
|
**4,108,488 bytes**, corpus **512/612 compile-OK**, 0 crashes.
|
|
**4,108,488 bytes**, corpus **512/612 compile-OK**, 0 crashes.
|
|
|
Existing trap tests must stay rc=134.
|
|
Existing trap tests must stay rc=134.
|
|
|
|
|
|
|
@@ -629,9 +629,11 @@ Existing trap tests must stay rc=134.
|
|
|
- `SYSTEM.THROW`, signal mapping for `SIGSEGV`/`SIGFPE`.
|
|
- `SYSTEM.THROW`, signal mapping for `SIGSEGV`/`SIGFPE`.
|
|
|
- Positive tests for `THROW`, `RETRY`, `RETURN`, nested handlers,
|
|
- Positive tests for `THROW`, `RETRY`, `RETURN`, nested handlers,
|
|
|
module bodies and NIL dereference.
|
|
module bodies and NIL dereference.
|
|
|
-3. **M3 — libraries**
|
|
|
|
|
|
|
+3. **M3 — libraries** — **done (2026-10-23)**
|
|
|
- `SysExceptions`, `EXCEPTIONS`, `M2EXCEPTION`.
|
|
- `SysExceptions`, `EXCEPTIONS`, `M2EXCEPTION`.
|
|
|
- - Library tests; `except5/7` variants; state-restoration queries.
|
|
|
|
|
|
|
+ - `t_except_lib`: `RAISE`, `CurrentNumber`, `GetMessage`,
|
|
|
|
|
+ `IsCurrentSource`, `IsExceptionalExecution`, wrong-source
|
|
|
|
|
+ `exException`, and `M2Exception` via `SYSTEM.THROW`.
|
|
|
4. **M4 — language traps**
|
|
4. **M4 — language traps**
|
|
|
- `TrapCode`; split index/range; CASE trap; range-check traps; keep
|
|
- `TrapCode`; split index/range; CASE trap; range-check traps; keep
|
|
|
rc=134 for unhandled; finish `t_except_trap`.
|
|
rc=134 for unhandled; finish `t_except_trap`.
|