فهرست منبع

language: SYSTEM sized reals REAL32/REAL64

minmaxreal3 imports REAL64 from SYSTEM (undeclared).  Map REAL32/REAL64
onto V3's REAL (dReal); MIN(REAL64)/MAX(REAL64) then fold.

Corpus 396 -> 397, 0 crashes.  Suite 232/232 (t_real64).  Fixpoint OK,
3,842,262 bytes.
Eric Streit 22 ساعت پیش
والد
کامیت
9877ce2ba1
8فایلهای تغییر یافته به همراه50 افزوده شده و 28 حذف شده
  1. 2 2
      README.md
  2. 1 0
      compiler/run_tests.sh
  3. 2 0
      compiler/src/SymTab.mod
  4. 11 0
      compiler/tests/t_real64.mod
  5. 2 2
      docs/INDEX.md
  6. 7 7
      docs/STATUS.md
  7. 7 4
      docs/analysis_gaps.md
  8. 18 13
      docs/summary_set-constants-2026-10-18.md

+ 2 - 2
README.md

@@ -47,8 +47,8 @@ docs/              STATUS.md, plan.md, plan-*.md, analysis_*.md, summary_*.md
 
 ## Status (2026-10-18)
 
-- Suite **231/231**; self-hosting **fixpoint OK** (byte-identical
-  stage2/stage3, 3,841,894 bytes); corpus **396/612 compile-OK,
+- Suite **232/232**; self-hosting **fixpoint OK** (byte-identical
+  stage2/stage3, 3,842,262 bytes); corpus **397/612 compile-OK,
   0 crashes** (`tools/v3-corpus`).
 - Active branch **`resolve-check`** (holds the AST/`Lower`/parse
   refactors and generics).

+ 1 - 0
compiler/run_tests.sh

@@ -102,6 +102,7 @@ expect_run t_constlong.mod 42
 expect_run t_arrfwd.mod 42
 expect_run t_procaddr.mod 42
 expect_run t_procval.mod 42
+expect_run t_real64.mod 42
 expect_run t_unicode.mod 31
 expect_run t_charbounds.mod 3
 expect_run t_record.mod 160

+ 2 - 0
compiler/src/SymTab.mod

@@ -3159,6 +3159,8 @@ PROCEDURE Init;
     (* gm2 sized/scalar names (mapped onto V3's families) *)
     Predef("LONGCARD", KindPredef, dLong);
     Predef("SHORTREAL", KindPredef, dReal);
+    Predef("REAL32", KindPredef, dReal);
+    Predef("REAL64", KindPredef, dReal);
     Predef("INTEGER8", KindPredef, dInt);
     Predef("INTEGER16", KindPredef, dInt);
     Predef("INTEGER32", KindPredef, dInt);

+ 11 - 0
compiler/tests/t_real64.mod

@@ -0,0 +1,11 @@
+MODULE TReal64;
+// SYSTEM sized-real names REAL32/REAL64 resolve, and MIN/MAX of a real
+// type fold to its implementation bounds.  Exit 42.
+FROM SYSTEM IMPORT REAL64;
+VAR min, max : REAL64;
+    ExitCode : INTEGER;
+BEGIN
+  min := MIN(REAL64);
+  max := MAX(REAL64);
+  IF min < max THEN ExitCode := 42 ELSE ExitCode := 1 END
+END TReal64.

+ 2 - 2
docs/INDEX.md

@@ -29,8 +29,8 @@ bisecting *why* a decision was made, not for reading end-to-end).
   bounds, set-of-enum, forward set); set-constant + folding findings.
 - `summary_set-constants-2026-10-18.md` — SET CONST (static masks,
   folded unions), builtin CONST folding (CAP/ABS/ODD, BOOLEAN consts),
-  CONST representation conversions, forward array-index types, and
-  procedure values.
+  CONST representation conversions, forward array-index types,
+  procedure values, and SYSTEM sized reals.
 - `summary_dlist-showcase-2026-10-16.md` — showcase23 + limitation fixes.
 - `summary_generics-limitations-fixed-2026-10-16.md` — the two
   template/proc-param limitations, fixed.

+ 7 - 7
docs/STATUS.md

@@ -4,10 +4,10 @@ This answers "where are we now?".
 
 ## Numbers
 
-- Suite **231/231** (`compiler/run_tests.sh`).
+- Suite **232/232** (`compiler/run_tests.sh`).
 - Self-hosting **FIXPOINT OK** — stage2 and stage3 images are
-  byte-identical (3,841,894 bytes).
-- Corpus **396 / 612** sources compile with 0 errors, **0 crashes**
+  byte-identical (3,842,262 bytes).
+- Corpus **397 / 612** sources compile with 0 errors, **0 crashes**
   (`tools/v3-corpus/corpus.sh` over the gm2 testsuite); the rest are
   genuine language gaps or unresolved imports.
 - Branch **`resolve-check`**; tree clean.
@@ -61,9 +61,9 @@ parameters, constraints, nested generics, generic classes.
   (`CAP`/`ABS`/`ODD` over immediates), `BOOLEAN` `CONST`s,
   representation-changing `CONST` conversions (`VAL(REAL, int)`,
   `VAL(LONGINT, int)`, …), **forward array-index types** (deferred,
-  patched at `EndTypeBlock`), and **procedure values** (`ADR(proc)`,
-  `VAL`↔`PROC` conversions, `p := foo` into a `PROC`):
-  corpus 382 → 396.
+  patched at `EndTypeBlock`), **procedure values** (`ADR(proc)`,
+  `VAL`↔`PROC` conversions, `p := foo` into a `PROC`), and SYSTEM sized
+  reals (`REAL32`/`REAL64`): corpus 382 → 397.
 - Clean `M2` exit codes (0 ok / 1 errors / 2 usage-IO).
 - Bug fixes: `PopPos` wiping repass diagnostics; global record data
   size (`w 0` → `l 0` for pointer/`LONGINT`/proc fields); template
@@ -91,7 +91,7 @@ parameters, constraints, nested generics, generic classes.
 ```sh
 cd compiler
 ./build.sh          # M2.atg -> scanner/parser/driver -> ./M2
-./run_tests.sh      # 231/231
+./run_tests.sh      # 232/232
 cd ..
 ./bootstrap/fixpoint.sh   # FIXPOINT OK (byte-identical stage2/stage3)
 ```

+ 7 - 4
docs/analysis_gaps.md

@@ -214,9 +214,12 @@ takes a procedure value into a `PROC`/pointer (`p := foo`), so
 `procconv` lands too.  Corpus **393 -> 396**; suite tests `t_procaddr`,
 `t_procval`.
 
+`REAL32`/`REAL64` (SYSTEM sized reals) are now predefined (mapped onto
+`REAL`), so `MIN(REAL64)`/`MAX(REAL64)` fold; `minmaxreal3` passes.
+Corpus **396 -> 397**; suite test `t_real64`.
+
 Next (recorded): forward *type* references in a `CONST` conversion
 (`subrange4`/`7`) and as a `VAR` type before its TYPE block
-(`subrange11`); `setconst3` (forward `CONST`); `minmaxreal3` (SYSTEM
-`REAL64`); `procconv2` (`CONVERT`); `tinyproc2`/`tinyproc4` (bare proc
-value as a statement); the `imp*` qualified-import family (partly a
-corpus-harness transitive-`.def` gap).
+(`subrange11`); `setconst3` (forward `CONST`); `procconv2` (`CONVERT`);
+`tinyproc2`/`tinyproc4` (bare proc value as a statement); the `imp*`
+qualified-import family (partly a corpus-harness transitive-`.def` gap).

+ 18 - 13
docs/summary_set-constants-2026-10-18.md

@@ -1,18 +1,18 @@
 # Session summary — SET CONST + builtin CONST folding 2026-10-18
 
-Branch **`resolve-check`**.  Suite **231/231**; fixpoint **OK
-(3,841,894 bytes)**; corpus **396/612 compile-OK, 0 crashes**.
+Branch **`resolve-check`**.  Suite **232/232**; fixpoint **OK
+(3,842,262 bytes)**; corpus **397/612 compile-OK, 0 crashes**.
 
 Tags: `v3-set-constants`, `v3-const-builtin-fold`, `v3-const-conv-fold`,
-`v3-array-index-fwd`, `v3-proc-addr`, `v3-proc-val`.
+`v3-array-index-fwd`, `v3-proc-addr`, `v3-proc-val`, `v3-real64`.
 
 ## What this session did
 
 Landed the two features recorded in `docs/analysis_gaps.md` §9 by the
 previous corpus sweep — **set constants** (static masks) and **builtin
 calls in `CONST` initialisers** — then went further on `CONST`
-initialisers, forward type references, and procedure values.  Corpus
-**382 → 396** (+14 files, 0 crashes).
+initialisers, forward type references, procedure values, and SYSTEM
+sized reals.  Corpus **382 → 397** (+15 files, 0 crashes).
 
 ```mod
 CONST Digits = CharSet{"0".."9"};          (* char range *)
@@ -102,6 +102,12 @@ variable, mapped onto `ADDRESS`): added `PROC`↔`PTR` assignability.
 `procconv` now passes and runs.  Corpus **393 → 396**; suite tests
 `t_procaddr`, `t_procval`.
 
+## SYSTEM sized reals
+
+`REAL32`/`REAL64` (SYSTEM) were undeclared; mapped onto V3's `REAL`
+(`dReal`), so `MIN(REAL64)`/`MAX(REAL64)` fold.  Corpus **396 → 397**;
+suite test `t_real64`.
+
 ## Not fixed (recorded)
 
 - **`setconst3.mod`** still fails: its `VAR mem: ARRAY [0..CARDINAL(
@@ -110,22 +116,21 @@ variable, mapped onto `ADDRESS`): added `PROC`↔`PTR` assignability.
   parses.
 - Forward *type* references in a `CONST` conversion (`subrange4`/`7`)
   and as a `VAR` type before its TYPE block (`subrange11`);
-  `minmaxreal3` (SYSTEM `REAL64`); `procconv2` (`CONVERT`);
-  `tinyproc2`/`tinyproc4` (bare procedure value as a statement); the
-  `imp*` qualified-import family (partly a corpus-harness
-  transitive-`.def` gap).
+  `procconv2` (`CONVERT`); `tinyproc2`/`tinyproc4` (bare procedure value
+  as a statement); the `imp*` qualified-import family (partly a corpus
+  harness transitive-`.def` gap).
 
 ## Files
 
 `compiler/src/Lower.{def,mod}` (evaluator + `PoolSet` call + `ADR(proc)`),
 `compiler/src/QbeGen.{def,mod}` (`PoolSet`/`FlushSets`/pool state),
 `compiler/src/SymTab.{def,mod}` (forward array-index deferral;
-proc-value assignability),
+proc-value assignability; sized reals),
 `compiler/src/M2.atg` (`ConstDecl`, `Design`, `CAP`/`ABS`/`ODD` folds,
 `VAL` conversion folds, array-index defer, proc-value conversions),
 `compiler/tests/t_setconst.mod`, `t_bad_setconst.mod`,
 `t_constbuiltin.mod`, `t_constreal.mod`, `t_constlong.mod`,
-`t_arrfwd.mod`, `t_procaddr.mod`, `t_procval.mod`,
+`t_arrfwd.mod`, `t_procaddr.mod`, `t_procval.mod`, `t_real64.mod`,
 `compiler/run_tests.sh`.
 
 ## Resume
@@ -133,7 +138,7 @@ proc-value assignability),
 ```sh
 cd .../m2compiler-V3
 git checkout resolve-check
-cd compiler && ./build.sh && ./run_tests.sh   # 231/231
+cd compiler && ./build.sh && ./run_tests.sh   # 232/232
 cd .. && TMP="$PWD/.scratch/fixpoint" ./bootstrap/fixpoint.sh
-M2FLAGS="" ./.scratch/corpusx.sh              # 396 OK, 0 crash
+M2FLAGS="" ./.scratch/corpusx.sh              # 397 OK, 0 crash
 ```