eyeprolog 1.3.58 → 1.3.59

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -226,7 +226,9 @@ precedence for `read_term/3`, `write_term/3`, `op/3`, and `current_op/3`, and
226
226
  the complete Part 1 flag defaults/value domains/changeability rules. The
227
227
  ongoing issue #65 audit additionally tightens Prolog-text declaration ordering,
228
228
  initialization lifetime, stream/open/close behavior, character/byte stream
229
- errors, `keysort/2` error cases, and strict arithmetic-extension boundaries.
229
+ errors, `keysort/2` error cases, the now-closed 5.5.6 side-effect and 5.5.10 evaluable-functor strict
230
+ extension boundaries, and the standard's permitted arithmetic variation points: mixed-type Corrigendum 2
231
+ `max/2`/`min/2` and signed Clause 9.4 bitwise/shift behavior.
230
232
  Those additions improve the Part 1 surface without turning the remaining audit
231
233
  rows into a blanket conformance claim. The post-N289 WG17/STC working draft is
232
234
  reviewed separately rather than treated as a fourth Corrigendum. The
@@ -236,6 +238,11 @@ proposal that would make the two power-underflow rows depend on the processor's
236
238
  9.1.4.2 `resultF` choice. Strict mode retains the published Part 1 +
237
239
  Corrigenda 1-3 behavior where the draft has not been standardized.
238
240
 
241
+ As an additional 5.5.1 extension-safety gate, every vendored WG17 syntax case
242
+ that succeeds in the strict Part 1 reader is re-run in the normal profile and
243
+ must retain the same observable outcome; normal mode may accept extra extension
244
+ syntax, but it must not reinterpret text already accepted as standard syntax.
245
+
239
246
  The auditable processor-requirement checklist lives in
240
247
  [`test/conformance/ISO-COMPLIANCE.md`](test/conformance/ISO-COMPLIANCE.md).
241
248
  The ISO 5.4 implementation-defined/implementation-specific decision index is
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.3.58",
6
+ "version": "1.3.59",
7
7
  "description": "EyeProlog turns facts and rules into answers and proofs.",
8
8
  "type": "module",
9
9
  "main": "./index.js",
@@ -27,13 +27,13 @@ relevant implementation-dependent overlap choice to an explicit audit outcome.
27
27
  | 5.1(d) document permitted variations | covered | The clause-by-clause [ISO 5.4 decision index](ISO-IMPLEMENTATION-DEFINED.md) records every explicit implementation-defined decision found in the Part 1 + Corrigenda baseline and separately inventories implementation-specific extension families. Rows marked `audit gap` remain conformance work, but the variation is no longer undocumented. |
28
28
  | 5.1(e) offer a strictly conforming mode | covered | `--iso-strict` and API option `isoStrict: true` restrict the processor to the Part 1 + Corrigenda 1-3 core language surface, remove EyeProlog-only registry/flag/operator features, disable automatic tabling/recursion guards, and reject the normal-profile host `stringTerm/1` term type at strict program/goal entry. |
29
29
  | 5.4 accompanying documentation | covered | *The Art of EyeProlog* remains the implementation reference; [ISO-IMPLEMENTATION-DEFINED.md](ISO-IMPLEMENTATION-DEFINED.md) is the closed clause-by-clause 5.4 decision index and points each decision to implementation evidence or an explicit audit gap. |
30
- | 5.5 extension boundaries | audit | [ISO-PROCESSOR-REQUIREMENTS.md](ISO-PROCESSOR-REQUIREMENTS.md) now splits 5.5 into its individual extension hooks. Operators, character conversion, the normal-profile host string type, directives, control constructs, flags, and reserved atoms have explicit decisions; exhaustive syntax-preservation, side-effect, built-in, and evaluable-functor dependency mapping remains open. |
30
+ | 5.5 extension boundaries | audit | [ISO-PROCESSOR-REQUIREMENTS.md](ISO-PROCESSOR-REQUIREMENTS.md) splits 5.5 into its individual extension hooks. Operators, character conversion, the normal-profile host string type, directives, control constructs, flags, built-ins, evaluable functors, and reserved atoms now have explicit decisions. The remaining open extension work is now concentrated in exhaustive syntax-preservation (5.5.1); the Prolog-visible additional-side-effect boundary (5.5.6) is explicitly filtered in strict mode and host instrumentation is documented as an embedding concern. |
31
31
 
32
32
  ## Normative language families
33
33
 
34
34
  | Standard area | Status | Current evidence |
35
35
  | --- | --- | --- |
36
- | Clause 6 — tokens, terms, lists, operators, quoted text | audit | Complete vendored WG17 syntax matrix, `lexical_and_curly_terms`, `scryer_lexical_terms`, operator suites, syntax-error cases, quoted-layout/escape error cases, writer/read-back regressions, and Unicode-scalar PCS/collation boundary tests. The implementation-defined 6.5/6.6 character-model decisions are now closed; wider shall-by-shall lexical mapping remains open. |
36
+ | Clause 6 — tokens, terms, lists, operators, quoted text | audit | Complete vendored WG17 syntax matrix, `lexical_and_curly_terms`, `scryer_lexical_terms`, operator suites, syntax-error cases, quoted-layout/escape error cases, writer/read-back regressions, and Unicode-scalar PCS/collation boundary tests. A cross-profile gate now verifies that every WG17 case accepted by the strict Part 1 reader has the same observable outcome under normal-mode syntax extensions. The implementation-defined 6.5/6.6 character-model decisions are closed; the remaining work is the explicit production-by-production shall map. |
37
37
  | 7.1-7.3 — term types, term order, unification | audit | Standard-order, identity, finite-tree and occurs-check suites, Corrigendum 2 term predicates, plus strict checks for the required `variable < float < integer < atom < compound` type order, PCS-based atom collation, and the `max_arity=unbounded` compound-term model. The normal JavaScript API string term is now explicitly documented as a 5.5.4 extension and rejected at strict program/goal entry so it cannot add a sixth strict-core type. |
38
38
  | 7.4 — Prolog text and directives | audit | All Part 1 directive indicators are parsed; include/ensure-loaded/operator/flag/character-conversion behavior has executable coverage. Preparation-time `char_conversion/2` affects later unquoted source text and respects `char_conversion=off`. Strict preparation now enforces declaration-before-clause ordering for `dynamic/1`, `multifile/1`, and `discontiguous/1`, cross-text `multifile/1`, discontiguous clause grouping, empty declared procedures, include textual-replacement behavior, and one-time initialization per prepared program. The remaining shall-by-shall mapping is still open. |
39
39
  | 7.5-7.6 — database and term/clause conversion | audit | Dynamic database and logical-update-view suites. Strict mode restores Part 1 private-static/public-dynamic `clause/2` access; focused strict checks cover the database built-ins and empty-procedure lifetime. Clause-body conversion now applies 7.6.2 both to prepared source clauses and runtime `asserta/1` / `assertz/1`: variables become `call/1`, `,/2`, `;/2`, and `->/2` are converted recursively, and head/body variable identity is preserved so `clause/2` and `retract/1` observe the converted term correctly. Runtime protection includes the solver-native conjunction control construct `','/2` and, following STC #56's accepted-direction action item, `(:-)/1-2` for database modification/private access while leaving their call behavior distinct. The remaining clause-conversion shall-by-shall mapping is still open. |
@@ -44,7 +44,7 @@ relevant implementation-dependent overlap choice to an explicit audit outcome.
44
44
  | 7.11 — flags | covered | The complete Part 1 flag set, selected defaults, standard value domains, changeability, `current_prolog_flag/2`, and `set_prolog_flag/2` error behavior have dedicated strict tests. EyeProlog selects `bounded=false` and `integer_rounding_function=toward_zero`; valid alternative values of those fixed flags reach `permission_error(modify,flag,...)`, while `max_integer` and `min_integer` have no current value. STC #70 is recorded explicitly: EyeProlog has no separate finite procedure-arity ceiling, so the optional `max_procedure_arity` flag is absent while `max_arity` remains `unbounded`. Strict mode excludes the EyeProlog `occurs_check` extension. |
45
45
  | 7.12 — errors | audit | ISO `error(Error, Context)` envelope, type/domain/permission/representation/evaluation/syntax/resource families and focused error cases. [ISO-BUILTIN-MODE-ERROR-MATRIX.md](ISO-BUILTIN-MODE-ERROR-MATRIX.md) now gives explicit mode/error-condition outcomes across the complete 8.2-8.17 built-in family, including Corrigendum additions and not-applicable conditional branches. The audit records the 7.12 rule that simultaneous error conditions are implementation dependent: overlap regressions document stable EyeProlog choices rather than inventing a universal table-order requirement. Remaining work is concentrated in non-built-in Clause 7 semantics, Clause 9 exceptional interactions, and processor-level error conditions. |
46
46
  | 8.2-8.17 — built-in predicates | covered | [ISO-BUILTIN-MODE-ERROR-MATRIX.md](ISO-BUILTIN-MODE-ERROR-MATRIX.md) now records the complete Part 1 + Corrigenda built-in family at one row per prescribed mode, success/failure behavior, individual error condition, and conditional/not-applicable branch. The row audit exposed and fixed source/runtime 7.6.2 body conversion/variable sharing, strict host-string leakage, input-code error timing, `close/2` force handling, and closed-stream `stream_property/2` behavior. Simultaneous-error choices are documented as implementation dependent under 7.12 unless separately constrained. |
47
- | Clause 9 — evaluable functors | audit | Integer/float/rounding/transcendental/bitwise suites and corrigendum cases. Strict mode excludes the EyeProlog-only evaluable atom `e`, retains Corrigendum 2 arithmetic additions, reports unknown zero-arity evaluables with the required `F/0` culprit shape, distinguishes non-evaluable `F/N` errors from numeric/integer operand errors per 7.9.2 and STC #69, and enforces float-only rounding modes, performs I->F conversion before floating functors (including overflow), reports the published `exp/1`, `**/2`, and Corrigendum 2 `^/2` underflow conditions, tracks STC #75's proposed conditional power interpretation without adopting it as published text, preserves the power-specific undefined conditions ahead of conversion overflow, and uses the Part 1 integer-to-float rule for mixed arithmetic comparisons. Normal mode retains EyeProlog's exact mixed-type comparison and round-to-zero arithmetic behavior as extensions. Unbounded BigInt resource exhaustion is translated into the Prolog error model rather than leaking host exceptions. Host floating-point representation choices remain documented implementation-defined behavior; the remaining exceptional-value rows are still under audit. |
47
+ | Clause 9 — evaluable functors | audit | Integer/float/rounding/transcendental/bitwise suites and corrigendum cases. Strict mode excludes the EyeProlog-only evaluable atom `e`, retains Corrigendum 2 arithmetic additions, reports unknown zero-arity evaluables with the required `F/0` culprit shape, distinguishes non-evaluable `F/N` errors from numeric/integer operand errors per 7.9.2 and STC #69, and enforces float-only rounding modes, performs I->F conversion before floating functors (including overflow), reports the published `exp/1`, `**/2`, and Corrigendum 2 `^/2` underflow conditions, tracks STC #75's proposed conditional power interpretation without adopting it as published text, preserves the power-specific undefined conditions ahead of conversion overflow, and uses the Part 1 integer-to-float rule for mixed arithmetic comparisons. Normal mode retains EyeProlog's exact mixed-type comparison and round-to-zero arithmetic behavior as extensions. Corrigendum 2 mixed-type `max/2`/`min/2` now have an explicit implementation-dependent decision: exact mathematical comparison selects one original operand and preserves its numeric type without mandatory integer-to-float conversion. Clause 9.4 signed bitwise operations and negative shift counts are likewise pinned to the documented BigInt infinite-two's-complement semantics. Unbounded BigInt resource exhaustion is translated into the Prolog error model rather than leaking host exceptions. Host floating-point representation choices remain documented implementation-defined behavior; the remaining exceptional-value rows are still under audit. |
48
48
  | Corrigendum 1 | covered | Double-quoted atom/operator-priority corrections have dedicated cases. |
49
49
  | Corrigendum 2 | covered | Added predicates/functors, catch corrections, bar/operator and uninstantiation corrections have dedicated cases. |
50
50
  | Corrigendum 3 | covered | Writer options, `variable_names/1`, canonical list output and negative-power corrections have dedicated cases. |
@@ -75,9 +75,9 @@ Status values are:
75
75
  | 9.1.4.1 | Floating-point rounding function `rndF` | Floating values and operations use ECMAScript `Number` (IEEE-754 binary64) and the host's specified binary64 arithmetic/conversions. | **defined** — `src/iso-arithmetic.js`, `src/number-value.js`. |
76
76
  | 9.1.4.2 | Floating-point result function for operations whose result is governed only by `resultF` | EyeProlog chooses `round(x)` rather than the optional exceptional value `underflow`. ECMAScript binary64 arithmetic therefore preserves a representable subnormal result and rounds a still-smaller generic arithmetic result to `0.0`, consistently with float-token, `number_chars/2`, and `number_codes/2` input. The published Part 1 `**/2` and Corrigendum 2 `^/2` tables still contain separate unconditional underflow rows, which strict mode retains; post-N289 STC #75 proposes making those two power rows conditional on this `resultF` choice and is tracked separately as draft work. `exp/1` has its own published exceptional condition and is not the subject of STC #75. | **defined** — arithmetic evaluation in `src/iso-arithmetic.js` and parser/number conversion; strict exceptional-value regressions. |
77
77
  | 9.1.4.3 | Approximate-addition function | ECMAScript binary64 addition is used; subtraction is implemented through the corresponding host operation and all finite results remain binary64 values. | **defined** — arithmetic evaluation in `src/iso-arithmetic.js`. |
78
- | 9.4 | Representation of negative integers for bitwise operations | BigInt's unbounded signed binary semantics are used, equivalent to an infinite two's-complement sign extension for bitwise operations. | **defined** — `src/iso-arithmetic.js` BigInt bitwise operators. |
79
- | 9.4.1 | Right shift of negative integers and unusual shift counts | `>>` is arithmetic/sign-propagating. A negative count reverses direction according to JavaScript BigInt shift semantics; there is no finite integer bit-size ceiling in the Prolog model. | **defined** — `a >> b` in `src/iso-arithmetic.js`. |
80
- | 9.4.2 | Left shift of negative integers and unusual shift counts | `<<` uses BigInt signed shift semantics; a negative count reverses direction. Resource exhaustion remains possible for very large results. | **defined** — `a << b` in `src/iso-arithmetic.js`. |
78
+ | 9.4 | Representation of negative integers for bitwise operations | BigInt's unbounded signed binary semantics are used, equivalent to an infinite two's-complement sign extension for bitwise operations. | **defined** — `src/iso-arithmetic.js` BigInt bitwise operators and strict Clause 9.4 boundary regressions. |
79
+ | 9.4.1 | Right shift of negative integers and unusual shift counts | `>>` is arithmetic/sign-propagating. A negative count reverses direction according to JavaScript BigInt shift semantics; there is no finite integer bit-size ceiling in the Prolog model. | **defined** — `a >> b` in `src/iso-arithmetic.js`; strict regressions pin negative operands/counts. |
80
+ | 9.4.2 | Left shift of negative integers and unusual shift counts | `<<` uses BigInt signed shift semantics; a negative count reverses direction. Resource exhaustion remains possible for very large results. | **defined** — `a << b` in `src/iso-arithmetic.js`; strict regressions pin negative counts and resource exhaustion. |
81
81
  | 9.4.3 | Bitwise AND with negative operands | BigInt infinite-two's-complement semantics. | **defined** — `a & b`. |
82
82
  | 9.4.4 | Bitwise OR with negative operands | BigInt infinite-two's-complement semantics. | **defined** — `a \| b`. |
83
83
  | 9.4.5 | Bitwise complement | BigInt complement, i.e. `~N = -N-1`. | **defined** — `~a`. |
@@ -118,11 +118,11 @@ families; `--iso-strict` is intended to remove their Part 1 interpretation.
118
118
  | 5.5.3 Character-conversion mapping | No non-identity initial `Convc` extension | Identity initial mapping. |
119
119
  | 5.5.4 Types | The normal JavaScript API exposes an implementation-specific string term `stringTerm(Text)`. It is disjoint from the five Part 1 term types; normal term order places it after atoms and before compound terms, and normal `atomic/1` treats it as atomic. It has no Prolog source token syntax (double-quoted source still follows `double_quotes`), is non-callable for term-to-clause conversion, is not evaluable as an arithmetic expression, and writes as a double-quoted host string. | Strict mode rejects a programmatic string term at program/goal entry with `representation_error(term)`, so the additional type cannot enter the Part 1 execution domain. **defined** — `src/term.js`, `src/program.js`, `src/solver.js`; strict API-boundary regression. |
120
120
  | 5.5.5 Directives | `module/2`, `use_module/1-2`, `meta_predicate/1` and normal-profile library behavior | Rejected as implementation-specific Part 1 directives. |
121
- | 5.5.6 Side effects | Host output/statistics, library-specific state, proof/statistics collection | The strict registry excludes library adapters; ordinary Part 1 I/O/database/flag/operator side effects remain. |
121
+ | 5.5.6 Side effects | Normal mode adds `statistics/0-2`, cleanup/library state, and optional proof/statistics host instrumentation. | The strict registry excludes Prolog-visible statistics/cleanup/library adapters; ordinary Part 1 I/O/database/flag/operator side effects remain. Host proof/statistics collection observes execution through the embedding API rather than adding a strict Prolog goal effect. **covered** — strict registry/execution regression. |
122
122
  | 5.5.7 Control constructs | `tnot/1` and normal-profile execution optimizations | `tnot/1` is absent; automatic tabling/recursion guards are disabled. |
123
123
  | 5.5.8 Flags | `occurs_check` | Absent in strict mode. |
124
124
  | 5.5.9 Built-in predicates | EyeProlog libraries, CLP(Z), statistics, Part 3 `phrase/2-3`, and interop autoloaded predicates | Strict registry contains only the Part 1 + Corrigenda core registry. |
125
- | 5.5.10 Evaluable functors | Library/runtime extensions when registered outside the strict core | Strict arithmetic registry is the Part 1 + Corrigenda set. |
125
+ | 5.5.10 Evaluable functors | Normal mode additionally accepts the EyeProlog evaluable atom `e`; the remaining arithmetic functors accepted by strict mode are the Part 1 + Corrigenda set. | Strict mode rejects `e/0` as non-evaluable and retains the Corrigendum arithmetic additions. **covered** — strict extension-boundary regression plus `src/iso-arithmetic.js`. |
126
126
  | 5.5.11 Reserved atoms | None | None. |
127
127
  | Cor.3 5.5.12 Options | Extra library/host options may exist outside core option lists | Normal mode additionally accepts the EyeProlog `write_term/2-3` option `double_quotes(true|false)`. Strict core excludes that extension and accepts only the Part 1 plus Corrigendum 3 write-option surface; unknown extension options raise `domain_error(write_option,...)`. |
128
128
 
@@ -139,6 +139,7 @@ For portability work, EyeProlog also documents these choices even though the
139
139
  - distinct variables are ordered by first encounter within the operation that
140
140
  needs a stable ordering;
141
141
  - expression arguments are evaluated left-to-right by the JavaScript evaluator;
142
+ - Corrigendum 2 mixed integer/float `max/2` and `min/2` use exact mathematical comparison and return one of the original operands without forcing integer-to-float conversion; equal values choose the left operand, so its original numeric type is preserved. EyeProlog does not elect the optional mixed-type `undefined` or `float_overflow` outcomes solely because the operand types differ;
142
143
  - generated variable names use EyeProlog's stable `_A`, `_B`, ... style within
143
144
  a write operation/top-level query;
144
145
  - resource and syntax-error detail atoms are EyeProlog implementation details;
@@ -8,7 +8,7 @@ compliance audit and the remaining work before a full conformance claim.
8
8
 
9
9
  | Standard area | Implementation | Representative executable coverage |
10
10
  | --- | --- | --- |
11
- | Clause 6 lexical and term syntax | tokenizer, operator parser, lists, curly terms, quotes, numeric syntax, comments, Unicode-scalar PCS/collation | `scryer_lexical_terms`, `lexical_and_curly_terms`, `double_quoted_lists`, `corrigendum1_double_quote_operator`, `wg17_syntax_high_risk`, `wg17_invalid_octal_escape`, `wg17_unterminated_quoted_token`, `wg17_literal_newline_in_quote`, `wg17_non_iso_escape`, strict PCS/collation tests in `run-iso-strict.mjs`, syntax error cases |
11
+ | Clause 6 lexical and term syntax | tokenizer, operator parser, lists, curly terms, quotes, numeric syntax, comments, Unicode-scalar PCS/collation | `scryer_lexical_terms`, `lexical_and_curly_terms`, `double_quoted_lists`, `corrigendum1_double_quote_operator`, `wg17_syntax_high_risk`, `wg17_invalid_octal_escape`, `wg17_unterminated_quoted_token`, `wg17_literal_newline_in_quote`, `wg17_non_iso_escape`, strict PCS/collation tests in `run-iso-strict.mjs`, syntax error cases, and a cross-profile check that all strict-success WG17 cases retain the same normal-profile outcome |
12
12
  | Clause 7 term order and unification | finite-tree unification, identity, standard order, errors | `unification_control_information`, `swipl_occurs_check`, `term_modes_and_ordering`, `logtalk_compare_standard_order` |
13
13
  | Clause 7 control and exceptions | call, cut, conjunction, disjunction, if-then-else, catch and throw | `cut_control`, `control_and_terms`, `exceptions_and_flags`, `corrigenda_catch_callability`, `throw_copies_ball` |
14
14
  | 8.2-8.5 term predicates | unification, Corrigendum 2 tests, comparison, sorting, creation and decomposition | `corrigenda_term_predicates`, `corrigenda_sort_keysort`, `logtalk_arg_unification`, `logtalk_univ`, associated error cases, and the one-row-per-mode/error 8.2-8.5 slice in `ISO-BUILTIN-MODE-ERROR-MATRIX.md`, including conditional finite-`max_arity` branches |
@@ -18,7 +18,7 @@ compliance audit and the remaining work before a full conformance claim.
18
18
  | 8.15 logic and control | negation, once, repeat, `call/2` through `call/8`, `false/0` | `logtalk_once`, `corrigenda_call_closure`, `false_builtin`, plus the complete 8.15 row-audit in `ISO-BUILTIN-MODE-ERROR-MATRIX.md` |
19
19
  | 8.16 atomic processing | atoms, characters, codes and number conversion with prescribed errors | `atomic_term_processing`, focused forward/reverse cases, parenthesized-number rejection, Logtalk-derived cases, and the complete 8.16 mode/error slice in `ISO-BUILTIN-MODE-ERROR-MATRIX.md` |
20
20
  | 8.17 flags and halt | complete required Part 1 flag set, selected defaults, standard value domains/changeability, and halt status handling | `exceptions_and_flags`, `remaining_builtins_and_directives`, the complete strict flag audit, halt cases, and explicit 8.17 rows in `ISO-BUILTIN-MODE-ERROR-MATRIX.md` |
21
- | Clause 9 evaluable functors | integer, float, rounding, transcendental and bitwise operations | `arithmetic`, `corrigenda_arithmetic`, `corrigenda_atan2_zero`, `corrigenda_integer_negative_power`, strict exclusion of the normal-mode `e` evaluable extension, zero-arity unknown-evaluable checks, prescribed operand/type and power-error precedence, float-only rounding modes, I->F overflow before floating functors, published `exp/1`/`**/2`/`^/2` underflow (with post-N289 STC #75 tracked separately), Part 1 mixed integer/float comparison conversion, and resource-error normalization for finite-host exhaustion of unbounded integer operations |
21
+ | Clause 9 evaluable functors | integer, float, rounding, transcendental and bitwise operations | `arithmetic`, `corrigenda_arithmetic`, `corrigenda_atan2_zero`, `corrigenda_integer_negative_power`, strict exclusion of the normal-mode `e` evaluable extension, zero-arity unknown-evaluable checks, prescribed operand/type and power-error precedence, float-only rounding modes, I->F overflow before floating functors, published `exp/1`/`**/2`/`^/2` underflow (with post-N289 STC #75 tracked separately), Part 1 mixed integer/float comparison conversion, the pinned Corrigendum 2 mixed-type `max/2`/`min/2` implementation-dependent choice, documented Clause 9.4 signed bitwise/negative-shift semantics, and resource-error normalization for finite-host exhaustion of unbounded integer operations |
22
22
  | Module compatibility profile (related to ISO/IEC 13211-2 and later WG17 amendment work) | module declarations, exports, imports, qualification, meta-predicate context | `modules/qualified_call`, `modules/selective_library_import`, `dcg_module_nonterminal_indicator` |
23
23
  | Part 3-oriented DCG compatibility profile | `-->`, terminal and partial sequences, grammar control constructs, semicontexts, nonterminal indicators, modules, `phrase/2-3`, steadfastness and errors | `dcg_terminals_and_remainder`, `dcg_control_constructs`, `dcg_partial_sequences`, `dcg_phrase_steadfastness`, `dcg_dynamic_nonterminal_indicator`, `logtalk_dcg_phrase_identity`, `logtalk_dcg_semicontexts`, DCG error and precedence cases |
24
24
 
@@ -35,16 +35,16 @@ certification claim.
35
35
  | Requirement | Status | EyeProlog decision / evidence |
36
36
  | --- | --- | --- |
37
37
  | 5.5 general extension rule | covered | normal mode may provide documented extensions; strict mode removes their Part 1 interpretation rather than changing implementation-defined choices |
38
- | 5.5.1 syntax extensions preserve standard token/text meaning | audit | WG17 syntax is a release gate and strict mode removes module/DCG/quad interpretation; a complete one-row preservation map for every Clause 6 production remains open |
38
+ | 5.5.1 syntax extensions preserve standard token/text meaning | audit | WG17 syntax is a release gate and strict mode removes module/DCG/quad interpretation. Every vendored WG17 case that succeeds in the Part 1 strict reader now has an identical normal-profile observable outcome, directly checking that normal syntax extensions do not reinterpret accepted standard text. A complete one-row preservation map for every Clause 6 production remains open |
39
39
  | 5.5.2 additional predefined operators | covered | strict mode starts from the Part 1 predefined operator table; normal-profile extra operators are documented and filtered |
40
40
  | 5.5.3 initial character-conversion mapping | covered | identity initial mapping; user changes are exercised through preparation/execution `char_conversion/2` behavior |
41
41
  | 5.5.4 additional term types | covered | the normal JavaScript API's `stringTerm(Text)` is documented as an implementation-specific sixth term type, including disjointness, ordering, clause conversion, lack of source token syntax, expression behavior, and writing; strict program/goal entry rejects that type with `representation_error(term)` |
42
42
  | 5.5.5 additional directives | covered | normal module/library directives are documented implementation-specific features and are rejected by strict mode |
43
- | 5.5.6 additional side effects | audit | host/proof/statistics/library effects are outside the strict registry or documented normal-mode behavior; exhaustive side-effect preservation mapping remains part of the Clause 7.7/7.10 audit |
43
+ | 5.5.6 additional side effects | covered | normal-profile `statistics/0-2`, cleanup/library state, proof/statistics host instrumentation, and other extension effects are documented outside the Part 1 core; strict registry tests exclude the Prolog-visible statistics/cleanup extensions. Host instrumentation is an embedding observation rather than an extra strict Prolog goal effect |
44
44
  | 5.5.7 additional control constructs | covered | `tnot/1` and implementation-specific execution optimizations are absent/disabled in strict mode; standard control constructs remain separately audited |
45
45
  | 5.5.8 additional flags | covered | normal `occurs_check` extension is absent from strict mode; the Part 1 flag family is fully audited |
46
46
  | 5.5.9 additional built-in predicates and error forms | covered | strict registry excludes normal-profile library/native additions; `ISO-BUILTIN-MODE-ERROR-MATRIX.md` closes the complete 8.2-8.17 family row-by-row; simultaneous-error choices are documented per 7.12 rather than treated as a global table-order mandate |
47
- | 5.5.10 additional evaluable functors/types | audit | strict mode excludes normal-profile arithmetic extensions such as evaluable `e`; the 9.1.4.2 `resultF` choice is documented, and post-N289 STC #75's proposed conditional power-underflow interpretation is kept separate from the published baseline; the remaining Clause 9 exceptional-value/error rows stay under audit |
47
+ | 5.5.10 additional evaluable functors/types | covered | strict mode rejects the normal-profile evaluable `e` extension while retaining the full Part 1 + Corrigenda arithmetic set. The 9.1.4.2 `resultF` choice, Corrigendum 2 mixed-type `max/2`/`min/2` choice, and Clause 9.4 signed bitwise/shift choices are documented and pinned by strict tests. Post-N289 STC #75 remains separate from the published baseline; the remaining Clause 9 semantic/error audit is tracked under 5.1(b)/5.3 rather than as an open extension-boundary decision |
48
48
  | 5.5.11 reserved atoms | not applicable | EyeProlog declares no reserved-atom extension; extension names remain ordinary atoms unless used in a documented syntactic/predicate/directive role |
49
49
 
50
50
  ## Exit-use rule
@@ -8,6 +8,7 @@ import {
8
8
  Env,
9
9
  compound,
10
10
  createStrictIsoRegistry,
11
+ getEyePrologRegistry,
11
12
  parseGoalText,
12
13
  parseProgramText,
13
14
  run,
@@ -673,6 +674,72 @@ export function runIsoStrict(reporter = new TestReporter()) {
673
674
  'evaluation_error(undefined)', 'zero-negative power precedes exponent conversion overflow');
674
675
  });
675
676
 
677
+ reporter.test('closes the 5.5.6 additional side-effect extension boundary', () => {
678
+ const normalRegistry = getEyePrologRegistry();
679
+ const strictRegistry = createStrictIsoRegistry();
680
+ equal(Boolean(normalRegistry.get('statistics', 0)), true, 'normal statistics/0 side-effect extension');
681
+ equal(Boolean(strictRegistry.get('statistics', 0)), false, 'strict statistics/0 excluded');
682
+ equal(Boolean(strictRegistry.get('statistics', 2)), false, 'strict statistics/2 excluded');
683
+ equal(Boolean(strictRegistry.get('call_cleanup', 2)), false, 'strict cleanup extension excluded');
684
+ equal(Boolean(strictRegistry.get('setup_call_cleanup', 3)), false, 'strict setup/cleanup extension excluded');
685
+ equal(capture(() => run('', { isoStrict: true, goal: 'statistics' })).formal,
686
+ 'existence_error(procedure)', 'strict execution cannot invoke statistics/0');
687
+ });
688
+
689
+ reporter.test('closes the 5.5.10 evaluable-functor extension boundary', () => {
690
+ const strictExtension = capture(() => run('', { isoStrict: true, goal: 'X is e' }));
691
+ equal(strictExtension.formal, 'type_error(evaluable)', 'normal-only e/0 is not evaluable in strict mode');
692
+ equal(run('', { goal: 'X is e' }).stats.completed_goal_lists, 1, 'normal e/0 extension remains available');
693
+
694
+ for (const goal of [
695
+ 'X is +1',
696
+ 'X is -7 div 3',
697
+ 'X is max(2,3.0)',
698
+ 'X is min(2.0,3)',
699
+ 'X is 3^3',
700
+ 'X is asin(0)',
701
+ 'X is acos(1)',
702
+ 'X is atan2(1,0)',
703
+ 'X is tan(0)',
704
+ 'X is pi',
705
+ 'X is xor(10,12)',
706
+ ]) equal(run('', { isoStrict: true, goal }).stats.completed_goal_lists, 1, `Corrigendum evaluable ${goal}`);
707
+ });
708
+
709
+ reporter.test('pins Corrigendum 2 mixed-type max/min implementation-dependent behavior', () => {
710
+ for (const goal of [
711
+ 'X is max(2.0,3), X == 3',
712
+ 'X is max(2,3.0), X == 3.0',
713
+ 'X is min(2.0,3), X == 2.0',
714
+ 'X is min(2,3.0), X == 2',
715
+ 'X is max(0,0.0), X == 0',
716
+ 'X is max(0.0,0), X == 0.0',
717
+ ]) equal(run('', { isoStrict: true, goal }).stats.completed_goal_lists, 1, goal);
718
+
719
+ // Corrigendum 2 permits several mixed-type choices, including returning
720
+ // one of the original operands without converting the integer to float.
721
+ // EyeProlog compares the mathematical values exactly and preserves the
722
+ // selected operand's original type, so a huge integer does not create a
723
+ // float-overflow merely because the other operand is a float.
724
+ const huge = `1${'0'.repeat(400)}`;
725
+ equal(run('', { isoStrict: true, goal: `X is max(${huge},1.0), X == ${huge}` }).stats.completed_goal_lists,
726
+ 1, 'mixed max/2 does not force integer-to-float conversion');
727
+ equal(run('', { isoStrict: true, goal: `X is min(${huge},1.0), X == 1.0` }).stats.completed_goal_lists,
728
+ 1, 'mixed min/2 preserves selected float operand');
729
+ });
730
+
731
+ reporter.test('pins implementation-defined Clause 9.4 signed bitwise and shift behavior', () => {
732
+ for (const goal of [
733
+ 'X is ((-16) >> 2), X == -4',
734
+ 'X is (16 >> -2), X == 64',
735
+ 'X is (16 << -2), X == 4',
736
+ 'X is ((-1) /\\ 5), X == 5',
737
+ 'X is ((-1) \\/ 5), X == -1',
738
+ 'X is xor(-1,5), X == -6',
739
+ 'X is \\ 5, X == -6',
740
+ ]) equal(run('', { isoStrict: true, goal }).stats.completed_goal_lists, 1, goal);
741
+ });
742
+
676
743
  reporter.test('uses the Part 1 mixed arithmetic comparison operations', () => {
677
744
  // 8.7 converts the integer operand to float in mixed comparisons.
678
745
  equal(run('', { isoStrict: true, goal: '18014398509481985 =:= 18014398509481984.0' }).stats.completed_goal_lists,
@@ -1245,21 +1245,34 @@ c4 ?- call((!;1)).
1245
1245
  run: () => {
1246
1246
  const filename = path.join(testRoot, 'fixtures', 'prologue_quad_runner.pl');
1247
1247
  const source = fs.readFileSync(filename, 'utf8');
1248
- const result = publicApi.runQuads(Program.parseSources([{
1248
+ const program = Program.parseSources([{
1249
1249
  text: source,
1250
1250
  filename,
1251
1251
  baseDir: path.dirname(filename),
1252
- }]));
1253
- assertEqual(result.total, 33, 'quad total');
1252
+ }]);
1253
+ assertEqual(program.quads.length, 33, 'vendored quad total');
1254
+ const maxIntegerQuads = program.quads.filter(({ query }) =>
1255
+ termToString(query).includes('current_prolog_flag(max_integer, Max)'));
1256
+ assertEqual(maxIntegerQuads.length, 1, 'max_integer quad count');
1257
+
1258
+ // This regression is about the one deliberate ISO divergence in the
1259
+ // upstream Prologue fixture. Running all 33 records also explores two
1260
+ // intentionally non-terminating STO examples and used to dominate the
1261
+ // regression suite by several seconds, without adding evidence for
1262
+ // max_integer. Keep the full vendored corpus intact, but execute only
1263
+ // the relevant record here.
1264
+ program.quads = maxIntegerQuads;
1265
+ const result = publicApi.runQuads(program);
1254
1266
  // The upstream working-draft quad accepts either integer overflow or
1255
1267
  // Max=unbounded. ISO/IEC 13211-1 7.11.1.1 instead says that when
1256
1268
  // bounded=false, current_prolog_flag(max_integer, N) fails. Preserve
1257
1269
  // the upstream fixture unchanged and make that one deliberate
1258
1270
  // standards-driven divergence explicit in the regression gate.
1259
- assertEqual(result.passed, 32, 'quad passed');
1271
+ assertEqual(result.total, 1, 'quad total');
1272
+ assertEqual(result.passed, 0, 'quad passed');
1260
1273
  assertEqual(result.failed, 1, 'quad failed');
1261
1274
  assertIncludes(result.stdout, 'current_prolog_flag(max_integer, Max)', 'max_integer divergence');
1262
- assertIncludes(result.stdout, 'quads: 33 run, 32 passed, 1 failed.', 'quad report');
1275
+ assertIncludes(result.stdout, 'quads: 1 run, 0 passed, 1 failed.', 'quad report');
1263
1276
  },
1264
1277
  },
1265
1278
  {
@@ -3531,6 +3544,21 @@ function documentationSyncCases() {
3531
3544
  );
3532
3545
  },
3533
3546
  },
3547
+ {
3548
+ name: 'normal syntax extensions preserve successful WG17 Part 1 outcomes',
3549
+ run: () => {
3550
+ const fixture = readWg17SyntaxFixture();
3551
+ let checked = 0;
3552
+ for (const item of fixture.cases) {
3553
+ const strict = executeWg17Item(item);
3554
+ if (strict.type !== 'success') continue;
3555
+ const normal = executeWg17Item(item, { isoStrict: false });
3556
+ assertEqual(JSON.stringify(normal), JSON.stringify(strict), `WG17 #${item.id} cross-profile outcome`);
3557
+ checked++;
3558
+ }
3559
+ if (checked === 0) throw new Error('WG17 fixture has no successful Part 1 syntax cases');
3560
+ },
3561
+ },
3534
3562
  {
3535
3563
  name: 'WG17 stream-sensitive cases #270 and #271 follow the upstream input protocol',
3536
3564
  run: () => {
package/test/run-wg17.mjs CHANGED
@@ -33,13 +33,13 @@ function capturedStages(stdout) {
33
33
  .map((match) => ({ output: match[2], variables: match[3] }));
34
34
  }
35
35
 
36
- function executeFinite(item) {
36
+ function executeFinite(item, isoStrict = true) {
37
37
  try {
38
38
  // Match the upstream protocol: the Query cell plus its terminating newline
39
39
  // is input to read(G), G (and subsequent read/call stages when present).
40
40
  // This is essential for stream-sensitive cases such as #270 and #271.
41
41
  const result = run('', {
42
- isoStrict: true,
42
+ isoStrict,
43
43
  goal: runnerStage(1, item.readCount ?? 16),
44
44
  ioOptions: { input: `${item.input}\n` },
45
45
  });
@@ -50,10 +50,10 @@ function executeFinite(item) {
50
50
  }
51
51
  }
52
52
 
53
- function executeWait(item) {
54
- const program = Program.parse('', { isoStrict: true });
53
+ function executeWait(item, isoStrict = true) {
54
+ const program = Program.parse('', { isoStrict });
55
55
  const solver = new Solver(program, {
56
- isoStrict: true,
56
+ isoStrict,
57
57
  ioOptions: { input: `${item.input}\n` },
58
58
  });
59
59
  const stream = solver.io.resolve('user_input');
@@ -63,7 +63,7 @@ function executeWait(item) {
63
63
  return null;
64
64
  };
65
65
  const goal = parseGoalText('read_term(G, [])', {
66
- isoStrict: true,
66
+ isoStrict,
67
67
  operatorDefinitions: [...program.operators.values()],
68
68
  });
69
69
  try {
@@ -310,10 +310,11 @@ export function wg17TestDescription(item) {
310
310
  return `#${item.id} ${query} -> ${expected}`;
311
311
  }
312
312
 
313
- export function executeWg17Item(item) {
313
+ export function executeWg17Item(item, options = {}) {
314
+ const isoStrict = options.isoStrict ?? true;
314
315
  return usesWaitMatcher(item.expected) || item.outcome?.type === 'waits'
315
- ? executeWait(item)
316
- : executeFinite(item);
316
+ ? executeWait(item, isoStrict)
317
+ : executeFinite(item, isoStrict);
317
318
  }
318
319
 
319
320
  function assertOutcome(item) {
@@ -7596,6 +7596,12 @@ gaps without turning draft WG17/STC proposals into the licensed baseline.
7596
7596
  upstream syntax cases. Reviewed cases can pin exact strict-reader outcomes, while
7597
7597
  newly upgraded cases execute directly against the upstream Codex expectation.
7598
7598
 
7599
+ The syntax audit also cross-checks extension safety: each vendored WG17 case
7600
+ accepted by the strict Part 1 reader is executed through the normal profile and
7601
+ must preserve the same observable outcome. Additional normal-mode syntax may
7602
+ accept texts outside the strict grammar, but it may not reinterpret an accepted
7603
+ standard case.
7604
+
7599
7605
  The complete suite must pass before release. The file-based conformance corpus
7600
7606
  contains 802 cases, including 386 focused ISO
7601
7607
  cases derived from the success, failure, mode, and error behavior in
@@ -7663,8 +7669,12 @@ strict boundary. The continuing issue #65 audit also enforces Part 1
7663
7669
  preparation constraints for `dynamic/1`, `multifile/1`, and `discontiguous/1`,
7664
7670
  keeps initialization tied to preparation of a program, tightens stream
7665
7671
  creation/position/EOF behavior and text-vs-binary permission errors, corrects
7666
- Corrigendum 2 `keysort/2` error cases, and keeps the non-standard evaluable atom
7667
- `e` outside strict mode. These are conformance improvements, while the
7672
+ Corrigendum 2 `keysort/2` error cases, closes the 5.5.6 Prolog-visible
7673
+ side-effect boundary by excluding statistics/cleanup extensions from strict
7674
+ mode, closes 5.5.10 by keeping the non-standard evaluable atom `e` outside
7675
+ strict mode, and pins the permitted arithmetic variation points for
7676
+ mixed-type Corrigendum 2 `max/2`/`min/2` plus signed Clause 9.4 bitwise and
7677
+ negative-shift behavior. These are conformance improvements, while the
7668
7678
  remaining qualifications are:
7669
7679
 
7670
7680
  - zero-arity compound syntax such as `ready()` is represented by the atom
package/why-eyeprolog.md CHANGED
@@ -28,7 +28,8 @@ collating-sequence integers in both normal and strict profiles. Strict mode
28
28
  therefore rejects implementation-specific language extensions without changing
29
29
  that processor choice. Its executable conformance matrix and tests
30
30
  document the supported behavior, including an executable trace of the vendored
31
- active WG17 syntax cases. This is extensive implementation evidence, not a
31
+ active WG17 syntax cases, cross-profile preservation of all strict-success WG17 syntax outcomes, closed strict side-effect and evaluable-functor extension boundaries, and explicit choices at standardized variation points such as mixed-type
32
+ `max/2`/`min/2` and signed bitwise/shift operations. This is extensive implementation evidence, not a
32
33
  claim that every Part 1, Part 2, or Part 3 normative requirement has already
33
34
  been certified or closed.
34
35