From e44bdc6a2a0cf624b08046ecc7e5c5d5d9d2d66c Mon Sep 17 00:00:00 2001 From: _ov4 Date: Fri, 16 Oct 2026 13:21:05 +0000 Subject: fix(compiler): correct CIE semantics and diagnostic locations Use standard WHILE headers and default-public class fields, resolve pseudocode identifiers without case sensitivity, and check signed i64 literal boundaries before conversion. Preserve source locations across recursive emission and function diagnostics. Add 22 regression cases and update compiler examples and documentation. Validated all 69 CTest entries with the original Linux Actions seed and verified the release package's embedded, native and IR output paths. --- tests/i/identifier-domains/case.json | 3 +++ tests/i/identifier-domains/expected.txt | 7 ++++++ tests/i/identifier-domains/notes.md | 5 ++++ tests/i/identifier-domains/program.cps | 43 +++++++++++++++++++++++++++++++++ 4 files changed, 58 insertions(+) create mode 100644 tests/i/identifier-domains/case.json create mode 100644 tests/i/identifier-domains/expected.txt create mode 100644 tests/i/identifier-domains/notes.md create mode 100644 tests/i/identifier-domains/program.cps (limited to 'tests/i/identifier-domains') diff --git a/tests/i/identifier-domains/case.json b/tests/i/identifier-domains/case.json new file mode 100644 index 0000000..1f18635 --- /dev/null +++ b/tests/i/identifier-domains/case.json @@ -0,0 +1,3 @@ +{ + "exit_code": 0 +} diff --git a/tests/i/identifier-domains/expected.txt b/tests/i/identifier-domains/expected.txt new file mode 100644 index 0000000..95fa0cf --- /dev/null +++ b/tests/i/identifier-domains/expected.txt @@ -0,0 +1,7 @@ +4 +6 +7:TRUE +8:9 +5:3 +5 +3 diff --git a/tests/i/identifier-domains/notes.md b/tests/i/identifier-domains/notes.md new file mode 100644 index 0000000..1a03605 --- /dev/null +++ b/tests/i/identifier-domains/notes.md @@ -0,0 +1,5 @@ +# identifier-domains + +Human review: pending. Expected output was independently traced, not captured from cpsc. + +CIE pp. 7, 28: names ignore case and omitted class access is public. The array is changed by reference to 4 and 6; the node is changed through its pointer to 7; Summer is the second enumerator. Class fields hold 8 and 9. The string length is 5 and the native int cast is 3. A block shadows Limit with 5, then restores 3. The function and procedure calls precede their definitions. diff --git a/tests/i/identifier-domains/program.cps b/tests/i/identifier-domains/program.cps new file mode 100644 index 0000000..d1b684b --- /dev/null +++ b/tests/i/identifier-domains/program.cps @@ -0,0 +1,43 @@ +TYPE Node + DECLARE Value : INTEGER +ENDTYPE +TYPE Link = ^Node +TYPE Season = (Spring, Summer) +TYPE Signed = C_TYPE("int") +CLASS Box + Value : INTEGER + PUBLIC Other : INTEGER + PRIVATE Hidden : INTEGER +ENDCLASS +CONSTANT Limit = 3 +DECLARE Item : nODE +DECLARE Ptr : lINK +DECLARE Mode : sEASON +DECLARE Crate : bOX +DECLARE Items : ARRAY[1:2] OF INTEGER +DECLARE Index : INTEGER +item.value <- limit +pTR <- ^ITEM +ptr^.vALUE <- 7 +mode <- sUMMER +crate.value <- 8 +CRATE.other <- 9 +CALL cHANGE(iTEMS) +FOR Index <- 1 TO 2 + OUTPUT items[index] +NEXT iNDEX +OUTPUT rEADnODE(ITEM), ":", MODE = summer +OUTPUT crate.VALUE, ":", crate.OTHER +OUTPUT length("MiXeD"), ":", (sIGNED)3 +IF TRUE THEN + CONSTANT lIMIT = 5 + OUTPUT LIMIT +ENDIF +OUTPUT Limit +PROCEDURE Change(BYREF Values : ARRAY OF INTEGER) + vALUES[1] <- 4 + VALUES[2] <- 6 +ENDPROCEDURE +FUNCTION ReadNode(Value : NODE) RETURNS INTEGER + RETURN vALUE.Value +ENDFUNCTION -- cgit v1.3.1-4-g156e