eyeprolog 1.3.69 → 1.3.71

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.
@@ -1,99 +0,0 @@
1
- # CLP(Z) migration toward Scryer's Prolog implementation
2
-
3
- EyeProlog's current `library(clpz)` has a Prolog API in `src/lib/clpz.pl` and a
4
- CLP(Z)-specific propagation store in `src/clpz.js`. The long-term target is to
5
- reuse Markus Triska's MIT-licensed [`clpz.pl` from Scryer
6
- Prolog](https://github.com/mthom/scryer-prolog/blob/master/src/lib/clpz.pl) and
7
- keep the JavaScript runtime responsible for generic Prolog VM facilities rather
8
- than a second finite-domain solver.
9
-
10
- ## Stage 1: attributed-variable substrate
11
-
12
- This stage is implemented. `Env` carries persistent per-module Prolog
13
- attributes in addition to the generic constraint descriptors introduced for
14
- `dif/2`. `src/atts.js` and `library(atts)` expose the operations required by the
15
- Scryer style: `put_atts/2`, `get_atts/2`, `put_attr/3`, `get_attr/3`,
16
- `del_attr/2`, and `term_attributed_variables/2`. The parser accepts the
17
- `attribute` declaration operator, Scryer-style comma-separated
18
- `:- attribute a/1, b/0.` directives, and `op/3` entries in module export lists.
19
-
20
- The important unification protocol is also implemented. Before an attributed
21
- variable is bound to a nonvariable, or before two variables carrying attributes
22
- for the same owner module are aliased, the solver invokes the owner's
23
- `verify_attributes/3`. A failed hook rejects the unification. Goals returned in
24
- the third argument are queued only after the binding succeeds. Aliasing an
25
- attributed variable with a plain variable transfers the persistent attribute map
26
- to the surviving representative, which is equivalent to Scryer's CLP(Z)
27
- `verify_attributes/3` transfer branch and avoids a recursive hook call while
28
- entering the hook itself.
29
-
30
- The substrate is covered by regressions for lookup, alias transfer, conflicting
31
- attributes, post-binding goals, backtracking, `term_attributed_variables/2`, and
32
- REPL projection through the conventional module `attribute_goals//1` hook.
33
- `examples/attributed-variables.pl` is the runnable source-level example.
34
-
35
- ## Stage 2: source expansion substrate
36
-
37
- This stage is implemented. Normal-profile source loading now invokes already
38
- loaded module-local and `user` `term_expansion/2` and `goal_expansion/2` hooks
39
- left-to-right. A term expansion may yield one clause or a list of clauses, and
40
- `expand_term/2` exposes the processor's DCG lowering so a hook can generate the
41
- ordinary clauses used by Scryer's CLP(Z) parser generators. Goal expansion is
42
- recursive across control constructs and preserves sharing with variables in the
43
- surrounding clause.
44
-
45
- Module-qualified hook clauses such as `user:goal_expansion/2` are also compiled
46
- with the correct split between procedure ownership and lexical body context. A
47
- hook defined from a library module therefore lives in `user` while its
48
- unqualified helper calls still resolve in the defining library. The compiler
49
- executes hooks with a fresh bounded solver against the partially built program;
50
- `solver.js` imports clause-selection helpers directly from `program-indexing.js`,
51
- so this compile-time service remains acyclic. Strict ISO Part 1 mode does not run
52
- these extension hooks.
53
-
54
- The regression corpus covers clause-list generation, variable-sharing goal
55
- expansion, qualified hook lexical context, and the Scryer pattern where a
56
- `term_expansion/2` hook calls `expand_term/2` to generate a DCG predicate.
57
-
58
- ## Stage 3: Scryer support-library surface
59
-
60
- This stage is implemented. EyeProlog now registers the library names imported by
61
- Scryer's current `clpz.pl`: `assoc`, `pairs`, `between`, `dcgs`, `terms`,
62
- `error`, `si`, `freeze`, `arithmetic`, `debug`, and `format`. The implementations
63
- are deliberately small compatibility layers where CLP(Z) needs only a subset of
64
- the upstream module, while observable predicate contracts stay at the Prolog
65
- library boundary. In particular, `library(freeze)` is implemented with the same
66
- attributed-variable `verify_attributes/3` protocol introduced in Stage 1.
67
-
68
- Two remaining Scryer runtime facilities are generic rather than constraint
69
- specific. `Env` now carries a copy-on-write backtrackable blackboard, exposed to
70
- Prolog through `bb_get/2` and `bb_b_put/2` compatibility wrappers, and
71
- `library(terms)` provides `copy_term_nat/2` using EyeProlog's attribute-free
72
- logical copy semantics. Regression coverage exercises the support modules,
73
- blackboard rollback, attribute-free copying, and the exact import/attribute
74
- prelude used by upstream CLP(Z).
75
-
76
- ## What still prevents replacing `src/clpz.js`
77
-
78
- The VM/compiler and named support-library blockers are now closed. The remaining
79
- work is direct upstream-source integration: vendor a pinned Scryer `clpz.pl`,
80
- apply only the small compatibility patches exposed by loading the complete file,
81
- and run it side-by-side against EyeProlog's existing CLP(Z) corpus plus selected
82
- Scryer regressions. Only after behavioral and performance parity should the
83
- `eyeprolog__clpz_*` adapters and `Env._clpz` store be removed.
84
-
85
- This boundary is intentional: Stage 3 does not claim that the complete upstream
86
- solver is active merely because its dependency prelude loads.
87
-
88
- ## Migration rule
89
-
90
- `src/clpz.js` remains the active implementation until an upstream-based Prolog
91
- solver passes the existing EyeProlog CLP(Z) corpus and the selected Scryer CLP(Z)
92
- regressions. During the transition it is the behavioral reference, not the
93
- architecture to extend. New generic VM work should go into attributed variables,
94
- term/goal expansion, or reusable library support where possible.
95
-
96
- Once the upstream source loads and reaches parity, remove the corresponding
97
- `eyeprolog__clpz_*` adapters and the `_clpz` store in one or more reviewable
98
- steps. Keep the upstream copyright and MIT license notice intact and keep local
99
- patches small enough that future Scryer updates can be diffed mechanically.