eyelang 0.5.1 → 0.5.2
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 +7 -7
- package/book-assets/cli-observation-loop.svg +1 -1
- package/book-assets/example-landscape.svg +1 -1
- package/book-assets/laboratory-progression.svg +1 -1
- package/book-assets/part-4-craft.svg +1 -1
- package/book-assets/rdf-adapter-pipeline.svg +3 -3
- package/book-assets/reference-navigation.svg +1 -1
- package/book-assets/review-lenses.svg +1 -1
- package/book-assets/title-page.svg +2 -2
- package/conformance-report.md +1 -1
- package/examples/book/README.md +4 -4
- package/examples/book/chapter-01/01-parent.pl +1 -1
- package/examples/book/chapter-01/02-child.pl +1 -1
- package/examples/book/chapter-02/01-measurement.pl +1 -1
- package/examples/book/chapter-02/02-label.pl +1 -1
- package/examples/book/chapter-03/01-eligible.pl +1 -1
- package/examples/book/chapter-03/02-adult.pl +1 -1
- package/examples/book/chapter-03/03-can_enter.pl +1 -1
- package/examples/book/chapter-03/04-high_score.pl +1 -1
- package/examples/book/chapter-03/05-parent.pl +1 -1
- package/examples/book/chapter-03/06-ancestor.pl +1 -1
- package/examples/book/chapter-03/07-different.pl +1 -1
- package/examples/book/chapter-03/08-has_parent.pl +1 -1
- package/examples/book/chapter-03/09-program.pl +1 -1
- package/examples/book/chapter-03/10-closed.pl +1 -1
- package/examples/book/chapter-03/11-p.pl +1 -1
- package/examples/book/chapter-04/01-path.pl +1 -1
- package/examples/book/chapter-05/01-first.pl +1 -1
- package/examples/book/chapter-05/02-reverse_acc.pl +1 -1
- package/examples/book/chapter-06/01-next.pl +1 -1
- package/examples/book/chapter-06/02-safe_reading.pl +1 -1
- package/examples/book/chapter-06/03-square.pl +1 -1
- package/examples/book/chapter-06/04-factorial.pl +1 -1
- package/examples/book/chapter-07/01-allowed.pl +1 -1
- package/examples/book/chapter-07/02-all_tests_pass.pl +1 -1
- package/examples/book/chapter-08/01-findall.pl +1 -1
- package/examples/book/chapter-08/02-outgoing_costs.pl +1 -1
- package/examples/book/chapter-08/03-best_route.pl +1 -1
- package/examples/book/chapter-09/01-functor.pl +1 -1
- package/examples/book/chapter-09/02-normalized.pl +1 -1
- package/examples/book/chapter-09/03-message.pl +1 -1
- package/examples/book/chapter-10/01-plan.pl +1 -1
- package/examples/book/chapter-11/01-why.pl +1 -1
- package/examples/book/chapter-12/01-invalid_probability.pl +1 -1
- package/examples/book/chapter-12/02-invalid_assignment.pl +1 -1
- package/examples/book/chapter-14/01-heating.pl +1 -1
- package/examples/book/chapter-15/01-rdf.pl +1 -1
- package/examples/book/chapter-16/01-socket.pl +1 -1
- package/examples/book/chapter-16/02-socket-2.pl +1 -1
- package/examples/book/chapter-17/01-path.pl +1 -1
- package/examples/book/chapter-17/02-adult.pl +1 -1
- package/examples/book/chapter-17/03-bad_member.pl +1 -1
- package/examples/book/chapter-17/04-item.pl +1 -1
- package/examples/book/chapter-18/01-routeable.pl +1 -1
- package/examples/book/chapter-18/02-routeable-2.pl +1 -1
- package/examples/book/chapter-18/03-prefix.pl +1 -1
- package/examples/book/chapter-18/04-candidate_pair.pl +1 -1
- package/examples/book/chapter-18/05-compatible_pair.pl +1 -1
- package/examples/book/chapter-19/01-factorial.pl +1 -1
- package/examples/book/chapter-19/02-invalid_limits.pl +1 -1
- package/examples/book/chapter-20/01-connected.pl +1 -1
- package/examples/book/chapter-20/02-within_thermal_limits.pl +1 -1
- package/examples/book/chapter-20/03-search.pl +1 -1
- package/examples/book/chapter-21/01-grandparent.pl +1 -1
- package/examples/book/chapter-21/02-loop_edge.pl +1 -1
- package/examples/book/chapter-21/03-eligible.pl +1 -1
- package/examples/book/chapter-21/04-grows.pl +1 -1
- package/examples/book/chapter-22/01-tree.pl +1 -1
- package/examples/book/chapter-22/02-tree_member.pl +1 -1
- package/examples/book/chapter-22/03-mirror.pl +1 -1
- package/examples/book/chapter-22/04-evaluate.pl +1 -1
- package/examples/book/chapter-22/05-lookup.pl +1 -1
- package/examples/book/chapter-22/06-simplify.pl +1 -1
- package/examples/book/chapter-23/01-adult.pl +1 -1
- package/examples/book/chapter-23/02-adult-2.pl +1 -1
- package/examples/book/chapter-23/03-can_board.pl +1 -1
- package/examples/book/chapter-23/04-traveler_in_good_standing.pl +1 -1
- package/examples/book/chapter-23/05-connection.pl +1 -1
- package/examples/book/chapter-23/06-rail_connection.pl +1 -1
- package/examples/book/chapter-23/07-sum_numbers.pl +1 -1
- package/examples/book/chapter-23/08-sum_numbers_acc.pl +1 -1
- package/examples/book/chapter-24/01-simple_path.pl +1 -1
- package/examples/book/chapter-24/02-reachable.pl +1 -1
- package/examples/book/chapter-24/03-best_plan.pl +1 -1
- package/examples/book/chapter-25/01-person.pl +1 -1
- package/examples/book/chapter-25/02-active_badge.pl +1 -1
- package/examples/book/chapter-25/03-in_good_standing.pl +1 -1
- package/examples/book/chapter-25/04-incompatible_status.pl +1 -1
- package/examples/book/chapter-26/01-mortal.pl +1 -1
- package/examples/book/chapter-26/02-triple.pl +1 -1
- package/examples/book/chapter-26/03-edge.pl +1 -1
- package/examples/book/chapter-27/01-natural.pl +1 -1
- package/examples/book/chapter-27/02-list_length.pl +1 -1
- package/examples/book/chapter-27/03-reverse_acc.pl +1 -1
- package/examples/book/chapter-28/01-program.pl +1 -1
- package/examples/book/chapter-28/02-triangle.pl +1 -1
- package/examples/book/chapter-28/03-rectangle.pl +1 -1
- package/examples/book/chapter-28/04-preserves_combine.pl +1 -1
- package/examples/book/chapter-29/01-noncommuting_pair.pl +1 -1
- package/examples/book/chapter-32/01-eligible.pl +1 -1
- package/examples/book/chapter-32/02-eligible-2.pl +1 -1
- package/examples/book/chapter-33/01-assigned_badge.pl +1 -1
- package/examples/book/chapter-33/02-source_role.pl +1 -1
- package/examples/book/chapter-33/03-chosen_pair.pl +1 -1
- package/examples/book/chapter-33/04-path.pl +1 -1
- package/examples/book/chapter-33/05-unregistered.pl +1 -1
- package/examples/book/chapter-33/06-step.pl +1 -1
- package/examples/book/chapter-33/07-depends.pl +1 -1
- package/examples/book/chapter-33/08-within_limit.pl +1 -1
- package/examples/book/chapter-33/09-invalid_badge_assignment.pl +1 -1
- package/examples/book/chapter-33/10-theory_version.pl +1 -1
- package/examples/book/chapter-34/01-travel_status.pl +1 -1
- package/examples/book/chapter-34/02-require_route.pl +1 -1
- package/examples/book/chapter-34/03-regional_total.pl +1 -1
- package/examples/book/chapter-35/01-term_shape.pl +1 -1
- package/examples/book/chapter-36/01-program.pl +1 -1
- package/examples/book/chapter-36/02-program-2.pl +1 -1
- package/examples/book/chapter-36/03-program-3.pl +1 -1
- package/examples/book/chapter-37/01-write_event.pl +1 -1
- package/examples/book/chapter-38/01-city.pl +1 -1
- package/examples/cdcl-sat-solver.pl +2 -2
- package/examples/collatz-1000.pl +1 -1
- package/examples/equality-saturation.pl +1 -1
- package/examples/existential-rule.pl +1 -1
- package/examples/herbrand-semantics.pl +1 -1
- package/examples/herbrand-witnesses.pl +1 -1
- package/examples/iso-integer-arithmetic.pl +1 -1
- package/examples/knowledge-engineering-alignment-flow.pl +1 -1
- package/examples/language.pl +2 -2
- package/examples/law-of-cosines.pl +1 -1
- package/examples/linear-logic-resources.pl +1 -1
- package/examples/markov-logic-network.pl +1 -1
- package/examples/matrix-noncommutativity.pl +1 -1
- package/examples/partial-evaluator.pl +1 -1
- package/examples/peano-calculus.pl +1 -1
- package/examples/prime-range.pl +1 -1
- package/examples/register-allocation.pl +1 -1
- package/examples/route-planning.pl +1 -1
- package/examples/sat-solver-dpll.pl +1 -1
- package/examples/symbolic-derivative.pl +1 -1
- package/examples/term-tools.pl +1 -1
- package/examples/trust-flow-provenance-threshold.pl +1 -1
- package/examples/vector-similarity.pl +1 -1
- package/examples/web-names.pl +1 -1
- package/examples/workplace-compliance.pl +1 -1
- package/index.d.ts +68 -68
- package/index.js +1 -1
- package/package.json +2 -2
- package/playground.html +10 -10
- package/src/cli.js +4 -4
- package/src/explain.js +4 -4
- package/src/index.js +4 -4
- package/src/iso.js +1 -1
- package/src/library.js +7 -7
- package/src/parser.js +1 -1
- package/src/playground-worker.js +2 -2
- package/src/solver.js +4 -4
- package/src/term.js +1 -1
- package/test/conformance/README.md +6 -6
- package/test/conformance/THIRD_PARTY.md +4 -4
- package/test/conformance/cases/iso/logtalk_abolish.pl +1 -1
- package/test/conformance/cases/iso/logtalk_arg_unification.pl +1 -1
- package/test/conformance/cases/iso/logtalk_assert_order.pl +1 -1
- package/test/conformance/cases/iso/logtalk_atom_chars.pl +1 -1
- package/test/conformance/cases/iso/logtalk_atom_codes.pl +1 -1
- package/test/conformance/cases/iso/logtalk_atom_concat.pl +1 -1
- package/test/conformance/cases/iso/logtalk_atom_length.pl +1 -1
- package/test/conformance/cases/iso/logtalk_bagof.pl +1 -1
- package/test/conformance/cases/iso/logtalk_char_code.pl +1 -1
- package/test/conformance/cases/iso/logtalk_clause.pl +1 -1
- package/test/conformance/cases/iso/logtalk_compare_standard_order.pl +1 -1
- package/test/conformance/cases/iso/logtalk_copy_term_semantics.pl +1 -1
- package/test/conformance/cases/iso/logtalk_current_predicate.pl +1 -1
- package/test/conformance/cases/iso/logtalk_current_streams.pl +1 -1
- package/test/conformance/cases/iso/logtalk_findall.pl +1 -1
- package/test/conformance/cases/iso/logtalk_number_chars.pl +1 -1
- package/test/conformance/cases/iso/logtalk_number_codes.pl +1 -1
- package/test/conformance/cases/iso/logtalk_occurs_check.pl +1 -1
- package/test/conformance/cases/iso/logtalk_once.pl +1 -1
- package/test/conformance/cases/iso/logtalk_operators.pl +1 -1
- package/test/conformance/cases/iso/logtalk_prolog_flags.pl +1 -1
- package/test/conformance/cases/iso/logtalk_repeat.pl +1 -1
- package/test/conformance/cases/iso/logtalk_retract.pl +1 -1
- package/test/conformance/cases/iso/logtalk_setof.pl +1 -1
- package/test/conformance/cases/iso/logtalk_sub_atom.pl +1 -1
- package/test/conformance/cases/iso/logtalk_term_comparison.pl +1 -1
- package/test/conformance/cases/iso/logtalk_term_variables.pl +1 -1
- package/test/conformance/cases/iso/logtalk_univ.pl +1 -1
- package/test/conformance/cases/strings/064_reusable_string_builtins.pl +3 -3
- package/test/conformance/cases/strings/071_string_edges.pl +1 -1
- package/test/conformance/errors/iso/logtalk_abolish_arity_type.pl +1 -1
- package/test/conformance/errors/iso/logtalk_abolish_bad_indicator.pl +1 -1
- package/test/conformance/errors/iso/logtalk_abolish_name_type.pl +1 -1
- package/test/conformance/errors/iso/logtalk_abolish_negative_arity.pl +1 -1
- package/test/conformance/errors/iso/logtalk_abolish_unbound.pl +1 -1
- package/test/conformance/errors/iso/logtalk_abolish_unbound_arity.pl +1 -1
- package/test/conformance/errors/iso/logtalk_arg_index_type.pl +1 -1
- package/test/conformance/errors/iso/logtalk_arg_number.pl +1 -1
- package/test/conformance/errors/iso/logtalk_asserta_bad_body.pl +1 -1
- package/test/conformance/errors/iso/logtalk_asserta_noncallable.pl +1 -1
- package/test/conformance/errors/iso/logtalk_assertz_noncallable.pl +1 -1
- package/test/conformance/errors/iso/logtalk_atom_chars_atom_type.pl +1 -1
- package/test/conformance/errors/iso/logtalk_atom_chars_character_type.pl +1 -1
- package/test/conformance/errors/iso/logtalk_atom_chars_improper.pl +1 -1
- package/test/conformance/errors/iso/logtalk_atom_chars_list_type.pl +1 -1
- package/test/conformance/errors/iso/logtalk_atom_chars_unbound.pl +1 -1
- package/test/conformance/errors/iso/logtalk_atom_codes_atom_type.pl +1 -1
- package/test/conformance/errors/iso/logtalk_atom_codes_bad_code.pl +1 -1
- package/test/conformance/errors/iso/logtalk_atom_codes_integer_type.pl +1 -1
- package/test/conformance/errors/iso/logtalk_atom_codes_list_type.pl +1 -1
- package/test/conformance/errors/iso/logtalk_atom_codes_unbound.pl +1 -1
- package/test/conformance/errors/iso/logtalk_atom_concat_left_type.pl +1 -1
- package/test/conformance/errors/iso/logtalk_atom_concat_right_type.pl +1 -1
- package/test/conformance/errors/iso/logtalk_atom_concat_unbound.pl +1 -1
- package/test/conformance/errors/iso/logtalk_atom_concat_whole_type.pl +1 -1
- package/test/conformance/errors/iso/logtalk_atom_length_atom_type.pl +1 -1
- package/test/conformance/errors/iso/logtalk_atom_length_integer_type.pl +1 -1
- package/test/conformance/errors/iso/logtalk_atom_length_negative.pl +1 -1
- package/test/conformance/errors/iso/logtalk_atom_length_unbound.pl +1 -1
- package/test/conformance/errors/iso/logtalk_bagof_improper.pl +1 -1
- package/test/conformance/errors/iso/logtalk_bagof_nonlist.pl +1 -1
- package/test/conformance/errors/iso/logtalk_char_code_character_type.pl +1 -1
- package/test/conformance/errors/iso/logtalk_char_code_integer_type.pl +1 -1
- package/test/conformance/errors/iso/logtalk_char_code_negative.pl +1 -1
- package/test/conformance/errors/iso/logtalk_char_code_number_character.pl +1 -1
- package/test/conformance/errors/iso/logtalk_char_code_unbound.pl +1 -1
- package/test/conformance/errors/iso/logtalk_clause_noncallable_body.pl +1 -1
- package/test/conformance/errors/iso/logtalk_clause_noncallable_head.pl +1 -1
- package/test/conformance/errors/iso/logtalk_compare_order_domain.pl +1 -1
- package/test/conformance/errors/iso/logtalk_compare_order_type.pl +1 -1
- package/test/conformance/errors/iso/logtalk_current_flag_compound.pl +1 -1
- package/test/conformance/errors/iso/logtalk_current_flag_name_type.pl +1 -1
- package/test/conformance/errors/iso/logtalk_current_flag_unknown.pl +1 -1
- package/test/conformance/errors/iso/logtalk_current_input_bad_stream.pl +1 -1
- package/test/conformance/errors/iso/logtalk_current_op_bad_specifier.pl +1 -1
- package/test/conformance/errors/iso/logtalk_current_op_high_priority.pl +1 -1
- package/test/conformance/errors/iso/logtalk_current_output_bad_stream.pl +1 -1
- package/test/conformance/errors/iso/logtalk_current_predicate_bad_name.pl +1 -1
- package/test/conformance/errors/iso/logtalk_current_predicate_negative_arity.pl +1 -1
- package/test/conformance/errors/iso/logtalk_current_predicate_scalar.pl +1 -1
- package/test/conformance/errors/iso/logtalk_findall_improper.pl +1 -1
- package/test/conformance/errors/iso/logtalk_findall_nonlist.pl +1 -1
- package/test/conformance/errors/iso/logtalk_functor_arity_type.pl +1 -1
- package/test/conformance/errors/iso/logtalk_functor_compound_name.pl +1 -1
- package/test/conformance/errors/iso/logtalk_functor_float_name.pl +1 -1
- package/test/conformance/errors/iso/logtalk_number_chars_character_type.pl +1 -1
- package/test/conformance/errors/iso/logtalk_number_chars_list_type.pl +1 -1
- package/test/conformance/errors/iso/logtalk_number_chars_number_type.pl +1 -1
- package/test/conformance/errors/iso/logtalk_number_chars_partial.pl +1 -1
- package/test/conformance/errors/iso/logtalk_number_chars_syntax.pl +1 -1
- package/test/conformance/errors/iso/logtalk_number_chars_unbound.pl +1 -1
- package/test/conformance/errors/iso/logtalk_number_codes_bad_code.pl +1 -1
- package/test/conformance/errors/iso/logtalk_number_codes_list_type.pl +1 -1
- package/test/conformance/errors/iso/logtalk_number_codes_number_type.pl +1 -1
- package/test/conformance/errors/iso/logtalk_number_codes_partial.pl +1 -1
- package/test/conformance/errors/iso/logtalk_number_codes_syntax.pl +1 -1
- package/test/conformance/errors/iso/logtalk_number_codes_unbound.pl +1 -1
- package/test/conformance/errors/iso/logtalk_once_noncallable.pl +1 -1
- package/test/conformance/errors/iso/logtalk_once_unbound.pl +1 -1
- package/test/conformance/errors/iso/logtalk_op_bad_specifier.pl +1 -1
- package/test/conformance/errors/iso/logtalk_op_high_priority.pl +1 -1
- package/test/conformance/errors/iso/logtalk_op_negative_priority.pl +1 -1
- package/test/conformance/errors/iso/logtalk_op_priority_type.pl +1 -1
- package/test/conformance/errors/iso/logtalk_op_unbound_name.pl +1 -1
- package/test/conformance/errors/iso/logtalk_op_unbound_priority.pl +1 -1
- package/test/conformance/errors/iso/logtalk_op_unbound_specifier.pl +1 -1
- package/test/conformance/errors/iso/logtalk_retract_unbound.pl +1 -1
- package/test/conformance/errors/iso/logtalk_retract_unbound_head.pl +1 -1
- package/test/conformance/errors/iso/logtalk_set_flag_name_type.pl +1 -1
- package/test/conformance/errors/iso/logtalk_set_flag_unbound_name.pl +1 -1
- package/test/conformance/errors/iso/logtalk_set_flag_unbound_value.pl +1 -1
- package/test/conformance/errors/iso/logtalk_set_flag_unknown.pl +1 -1
- package/test/conformance/errors/iso/logtalk_set_flag_value.pl +1 -1
- package/test/conformance/errors/iso/logtalk_setof_nonlist.pl +1 -1
- package/test/conformance/errors/iso/logtalk_sub_atom_before_type.pl +1 -1
- package/test/conformance/errors/iso/logtalk_sub_atom_negative.pl +1 -1
- package/test/conformance/errors/iso/logtalk_sub_atom_result_type.pl +1 -1
- package/test/conformance/errors/iso/logtalk_sub_atom_source_type.pl +1 -1
- package/test/conformance/errors/iso/logtalk_sub_atom_unbound.pl +1 -1
- package/test/conformance/errors/iso/logtalk_term_variables_improper.pl +1 -1
- package/test/conformance/errors/iso/logtalk_term_variables_nonlist.pl +1 -1
- package/test/conformance/errors/iso/logtalk_univ_head_compound.pl +1 -1
- package/test/conformance/errors/iso/logtalk_univ_head_float.pl +1 -1
- package/test/conformance/errors/iso/logtalk_univ_head_integer.pl +1 -1
- package/test/conformance/errors/iso/logtalk_univ_single_compound.pl +1 -1
- package/test/conformance/expected/strings/064_reusable_string_builtins.pl +1 -1
- package/test/run-conformance-report.mjs +4 -4
- package/test/run-conformance.mjs +3 -3
- package/test/run-playground.mjs +3 -3
- package/test/run-rdf-tools.mjs +15 -15
- package/test/run-regression.mjs +35 -35
- package/the-art-of-eyelang.md +136 -136
- package/tools/README.md +2 -2
- package/tools/extract-book-examples.mjs +4 -4
- package/tools/pl-to-rdf.mjs +2 -2
- package/tools/rdf-codec.mjs +8 -8
- package/tools/rdf-to-pl.mjs +9 -9
- package/why-eyelang.md +47 -47
package/test/run-regression.mjs
CHANGED
|
@@ -10,14 +10,14 @@ import { spawnSync } from 'node:child_process';
|
|
|
10
10
|
import { fileURLToPath } from 'node:url';
|
|
11
11
|
import * as publicApi from '../src/index.js';
|
|
12
12
|
import {
|
|
13
|
-
run as
|
|
13
|
+
run as runEyelang,
|
|
14
14
|
Program,
|
|
15
15
|
makeProgram,
|
|
16
16
|
Solver,
|
|
17
17
|
Env,
|
|
18
18
|
BuiltinRegistry,
|
|
19
19
|
createDefaultRegistry,
|
|
20
|
-
|
|
20
|
+
getEyelangRegistry,
|
|
21
21
|
atom,
|
|
22
22
|
compound,
|
|
23
23
|
listFromItems,
|
|
@@ -53,7 +53,7 @@ function run(source, options = {}) {
|
|
|
53
53
|
const goals = options.goals ?? (options.goal == null
|
|
54
54
|
? (programSource instanceof Program ? [] : goalsFromSource(text))
|
|
55
55
|
: [options.goal]);
|
|
56
|
-
return
|
|
56
|
+
return runEyelang(programSource, { ...options, goals });
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
function sourceAtom(value) {
|
|
@@ -196,12 +196,12 @@ why(
|
|
|
196
196
|
assertIncludes(result.stdout, '-v, --version', 'stdout');
|
|
197
197
|
assertIncludes(result.stdout, '-w, --warnings', 'stdout');
|
|
198
198
|
assertIncludes(result.stdout, '-v, --version Show the package version and exit.\n -w, --warnings Print non-fatal portability warnings to stderr.', 'stdout');
|
|
199
|
-
assertIncludes(result.stdout, 'Read an
|
|
199
|
+
assertIncludes(result.stdout, 'Read an Eyelang program', 'stdout');
|
|
200
200
|
assertEqual(result.stderr, '', 'stderr');
|
|
201
201
|
},
|
|
202
202
|
},
|
|
203
203
|
{
|
|
204
|
-
name: 'CLI loads
|
|
204
|
+
name: 'CLI loads Eyelang library predicates by default',
|
|
205
205
|
run: () => {
|
|
206
206
|
const result = runCli(['-'], {
|
|
207
207
|
input: '%% goal: answer(X)\nanswer(X) :- member(X, [library]).\n',
|
|
@@ -560,8 +560,8 @@ function documentationSyncCases() {
|
|
|
560
560
|
},
|
|
561
561
|
},
|
|
562
562
|
{
|
|
563
|
-
name: 'book
|
|
564
|
-
run: () => assertArrayEqual(
|
|
563
|
+
name: 'book Eyelang library matches runtime registry',
|
|
564
|
+
run: () => assertArrayEqual(bookEyelangLibraryNames(), registeredEyelangLibraryNames(), 'Eyelang library predicates'),
|
|
565
565
|
},
|
|
566
566
|
{
|
|
567
567
|
name: 'README links to the book and the book documents runtime boundaries',
|
|
@@ -570,7 +570,7 @@ function documentationSyncCases() {
|
|
|
570
570
|
const book = fs.readFileSync(path.join(packageRoot, 'the-art-of-eyelang.md'), 'utf8');
|
|
571
571
|
assertIncludes(
|
|
572
572
|
readme,
|
|
573
|
-
'[Book — *The Art of
|
|
573
|
+
'[Book — *The Art of Eyelang*](https://eyereasoner.github.io/eyelang/the-art-of-eyelang)',
|
|
574
574
|
'README links to the book',
|
|
575
575
|
);
|
|
576
576
|
for (const filename of ['src/iso.js', 'src/library.js', 'src/playground-worker.js']) {
|
|
@@ -628,7 +628,7 @@ function documentationSyncCases() {
|
|
|
628
628
|
run: () => assertArrayEqual(documentedPublicApiImportIssues(), [], 'documentation API imports'),
|
|
629
629
|
},
|
|
630
630
|
{
|
|
631
|
-
name: 'documentation uses
|
|
631
|
+
name: 'documentation uses Eyelang source style',
|
|
632
632
|
run: () => assertArrayEqual(documentationSourceStyleIssues(), [], 'documentation source style'),
|
|
633
633
|
},
|
|
634
634
|
{
|
|
@@ -772,14 +772,14 @@ function apiCases() {
|
|
|
772
772
|
},
|
|
773
773
|
},
|
|
774
774
|
{
|
|
775
|
-
name: 'default
|
|
775
|
+
name: 'default Eyelang registry keeps dynamic program state consistent',
|
|
776
776
|
run: () => {
|
|
777
777
|
const program = Program.parse([
|
|
778
778
|
':- dynamic(item/1).',
|
|
779
779
|
'%% goal: done',
|
|
780
780
|
'done :- assertz(item(a)), retract(item(a)), assertz(item(b)), abolish(item/1).',
|
|
781
781
|
].join('\n'));
|
|
782
|
-
const result = run(program, { goal: 'done', registry:
|
|
782
|
+
const result = run(program, { goal: 'done', registry: getEyelangRegistry() });
|
|
783
783
|
assertEqual(result.stdout, 'done.\n', 'stdout');
|
|
784
784
|
assertEqual(program.findGroup('item', 1), null, 'abolished group');
|
|
785
785
|
assertEqual(
|
|
@@ -945,14 +945,14 @@ open(X) :- candidate(X), \\+ closed(X).
|
|
|
945
945
|
},
|
|
946
946
|
},
|
|
947
947
|
{
|
|
948
|
-
name: 'run loads the
|
|
948
|
+
name: 'run loads the Eyelang library by default',
|
|
949
949
|
run: () => {
|
|
950
950
|
const result = run('answer(X) :- append([a], [b], X).', { goal: 'answer(X)' });
|
|
951
951
|
assertEqual(result.stdout, 'answer([a, b]).\n', 'stdout');
|
|
952
952
|
},
|
|
953
953
|
},
|
|
954
954
|
{
|
|
955
|
-
name: 'Solver loads the
|
|
955
|
+
name: 'Solver loads the Eyelang library by default',
|
|
956
956
|
run: () => {
|
|
957
957
|
const program = Program.parse('answer(X) :- append([a], [b], X).');
|
|
958
958
|
const solver = new Solver(program);
|
|
@@ -997,15 +997,15 @@ open(X) :- candidate(X), \\+ closed(X).
|
|
|
997
997
|
},
|
|
998
998
|
},
|
|
999
999
|
{
|
|
1000
|
-
name: 'ISO-only and
|
|
1000
|
+
name: 'ISO-only and Eyelang registries expose separate metadata',
|
|
1001
1001
|
run: () => {
|
|
1002
1002
|
const registry = createDefaultRegistry();
|
|
1003
|
-
const library =
|
|
1003
|
+
const library = getEyelangRegistry();
|
|
1004
1004
|
assertEqual(Boolean(registry.get('is', 2)), true, 'ISO is/2 exists');
|
|
1005
1005
|
assertEqual(Boolean(registry.get('append', 3)), false, 'append/3 is not ISO core');
|
|
1006
1006
|
assertEqual(library.eyeLangLibrary, true, 'complete registry marker');
|
|
1007
1007
|
assertEqual(library.defs.size, 165, 'complete registry size');
|
|
1008
|
-
assertEqual(
|
|
1008
|
+
assertEqual(registeredEyelangLibraryNames().length, 50, 'Eyelang library size');
|
|
1009
1009
|
assertEqual(library.get('append', 3)?.eyeLangLibrary, true, 'append/3 metadata');
|
|
1010
1010
|
assertEqual(library.get('maplist', 3)?.eyeLangLibrary, true, 'maplist/3 metadata');
|
|
1011
1011
|
assertEqual(library.get('matches', 3)?.eyeLangLibrary, true, 'matches/3 metadata');
|
|
@@ -1016,7 +1016,7 @@ open(X) :- candidate(X), \\+ closed(X).
|
|
|
1016
1016
|
},
|
|
1017
1017
|
},
|
|
1018
1018
|
{
|
|
1019
|
-
name: '
|
|
1019
|
+
name: 'Eyelang library does not inject program clauses',
|
|
1020
1020
|
run: () => {
|
|
1021
1021
|
const program = Program.parse('answer(X) :- append([a], [b], X).');
|
|
1022
1022
|
const solver = new Solver(program);
|
|
@@ -1027,7 +1027,7 @@ open(X) :- candidate(X), \\+ closed(X).
|
|
|
1027
1027
|
},
|
|
1028
1028
|
},
|
|
1029
1029
|
{
|
|
1030
|
-
name: '
|
|
1030
|
+
name: 'Eyelang library preserves relational and arithmetic behavior',
|
|
1031
1031
|
run: () => {
|
|
1032
1032
|
const result = run([
|
|
1033
1033
|
'%% goal: answer(A, B, S, M)',
|
|
@@ -1042,11 +1042,11 @@ open(X) :- candidate(X), \\+ closed(X).
|
|
|
1042
1042
|
'answer([a], [b], 5, 9007199254740993).',
|
|
1043
1043
|
'answer([a, b], [], 5, 9007199254740993).',
|
|
1044
1044
|
'',
|
|
1045
|
-
].join('\n'), '
|
|
1045
|
+
].join('\n'), 'Eyelang library behavior');
|
|
1046
1046
|
},
|
|
1047
1047
|
},
|
|
1048
1048
|
{
|
|
1049
|
-
name: '
|
|
1049
|
+
name: 'Eyelang library preserves strict modes and ISO arithmetic errors',
|
|
1050
1050
|
run: () => {
|
|
1051
1051
|
assertEqual(run('answer(X) :- substring("abc", "1", 1, X).', { goal: 'answer(X)' }).stdout, '', 'substring index type');
|
|
1052
1052
|
let nth1Error = null;
|
|
@@ -1485,10 +1485,10 @@ function bookReferenceDocumentationIssues() {
|
|
|
1485
1485
|
const guide = fs.readFileSync(path.join(testRoot, 'conformance', 'README.md'), 'utf8');
|
|
1486
1486
|
const issues = [];
|
|
1487
1487
|
|
|
1488
|
-
if (!book.includes('This book is also the reference for the
|
|
1488
|
+
if (!book.includes('This book is also the reference for the Eyelang implementation.')) {
|
|
1489
1489
|
issues.push('book introduction does not identify itself as the reference');
|
|
1490
1490
|
}
|
|
1491
|
-
if (!book.includes('This book is the single reference for the
|
|
1491
|
+
if (!book.includes('This book is the single reference for the Eyelang implementation.')) {
|
|
1492
1492
|
issues.push('book Chapter 42 does not state the single-reference policy');
|
|
1493
1493
|
}
|
|
1494
1494
|
for (const standard of [
|
|
@@ -1499,16 +1499,16 @@ function bookReferenceDocumentationIssues() {
|
|
|
1499
1499
|
]) {
|
|
1500
1500
|
if (!book.includes(standard)) issues.push(`book does not identify standards baseline: ${standard}`);
|
|
1501
1501
|
}
|
|
1502
|
-
if (!book.includes('
|
|
1502
|
+
if (!book.includes('Eyelang performs it consistently for ordinary\nunification as well as `unify_with_occurs_check/2`.')) {
|
|
1503
1503
|
issues.push('book glossary does not match finite-tree unification');
|
|
1504
1504
|
}
|
|
1505
|
-
if (book.includes('
|
|
1505
|
+
if (book.includes('Eyelang does not perform it.')) {
|
|
1506
1506
|
issues.push('book contradicts implementation occurs-check behavior');
|
|
1507
1507
|
}
|
|
1508
|
-
for (const heading of ['## 38. Language and ISO profile', '## 39. Built-in predicates by programming role', '## 40. Running
|
|
1508
|
+
for (const heading of ['## 38. Language and ISO profile', '## 39. Built-in predicates by programming role', '## 40. Running Eyelang: command line and corpus']) {
|
|
1509
1509
|
if (!book.includes(heading)) issues.push(`book is missing ${heading}`);
|
|
1510
1510
|
}
|
|
1511
|
-
if (!guide.includes('[*The Art of
|
|
1511
|
+
if (!guide.includes('[*The Art of Eyelang*](../../the-art-of-eyelang.md) is the reference')) {
|
|
1512
1512
|
issues.push('test guide does not identify the book as the reference');
|
|
1513
1513
|
}
|
|
1514
1514
|
if (!guide.includes('not a separate\nlanguage specification')) {
|
|
@@ -1523,7 +1523,7 @@ function runWhy({ program, goalText, expected }) {
|
|
|
1523
1523
|
fs.writeFileSync(programFile, program);
|
|
1524
1524
|
const goal = parseGoalText(goalText);
|
|
1525
1525
|
const parsed = Program.parseSources([{ text: program, filename: path.basename(programFile) }], { sourceMetadata: true });
|
|
1526
|
-
const result =
|
|
1526
|
+
const result = runEyelang(parsed, { proof: true, goal });
|
|
1527
1527
|
const expectedText = expected.replaceAll('__FILE__', path.basename(programFile));
|
|
1528
1528
|
assertEqual(result.stdout, expectedText, 'stdout');
|
|
1529
1529
|
|
|
@@ -1540,7 +1540,7 @@ function runWhyLoose({ program, goalText }) {
|
|
|
1540
1540
|
fs.writeFileSync(programFile, program);
|
|
1541
1541
|
const goal = parseGoalText(goalText);
|
|
1542
1542
|
const parsed = Program.parseSources([{ text: program, filename: path.basename(programFile) }], { sourceMetadata: true });
|
|
1543
|
-
const result =
|
|
1543
|
+
const result = runEyelang(parsed, { proof: true, goal });
|
|
1544
1544
|
Program.parse(result.stdout);
|
|
1545
1545
|
assertIncludes(result.stdout, '\n).\n\n', 'stdout');
|
|
1546
1546
|
return result;
|
|
@@ -1671,9 +1671,9 @@ function playgroundStaticIssues() {
|
|
|
1671
1671
|
if (!html.includes("new Worker(workerUrl, { type: 'module' })")) issues.push('playground must launch the dedicated module worker');
|
|
1672
1672
|
const workerText = fs.readFileSync(path.join(packageRoot, 'src', 'playground-worker.js'), 'utf8');
|
|
1673
1673
|
if (!workerText.includes("from './library.js?playground=") ||
|
|
1674
|
-
!workerText.includes('
|
|
1674
|
+
!workerText.includes('createEyelangRegistry') ||
|
|
1675
1675
|
!workerText.includes('executePlaygroundRequest')) {
|
|
1676
|
-
issues.push('playground worker must install the
|
|
1676
|
+
issues.push('playground worker must install the Eyelang library registry');
|
|
1677
1677
|
}
|
|
1678
1678
|
if (fs.existsSync(path.join(packageRoot, 'src', 'portable-library.js'))) {
|
|
1679
1679
|
issues.push('obsolete portable-library.js must be absent');
|
|
@@ -1732,9 +1732,9 @@ function registeredBuiltinNames() {
|
|
|
1732
1732
|
return [...createDefaultRegistry().defs.keys()].sort();
|
|
1733
1733
|
}
|
|
1734
1734
|
|
|
1735
|
-
function
|
|
1735
|
+
function registeredEyelangLibraryNames() {
|
|
1736
1736
|
const defaults = createDefaultRegistry().defs;
|
|
1737
|
-
return [...
|
|
1737
|
+
return [...getEyelangRegistry().defs.entries()]
|
|
1738
1738
|
.filter(([name]) => !defaults.has(name))
|
|
1739
1739
|
.map(([name]) => name)
|
|
1740
1740
|
.sort();
|
|
@@ -1750,10 +1750,10 @@ function registeredBuiltinSummary() {
|
|
|
1750
1750
|
|
|
1751
1751
|
function bookBuiltinNames() {
|
|
1752
1752
|
const book = fs.readFileSync(path.join(packageRoot, 'the-art-of-eyelang.md'), 'utf8');
|
|
1753
|
-
return documentedBuiltinNames(between(book, '## 39. Built-in predicates by programming role', '### The
|
|
1753
|
+
return documentedBuiltinNames(between(book, '## 39. Built-in predicates by programming role', '### The Eyelang library'), 2);
|
|
1754
1754
|
}
|
|
1755
1755
|
|
|
1756
|
-
function
|
|
1756
|
+
function bookEyelangLibraryNames() {
|
|
1757
1757
|
const book = fs.readFileSync(path.join(packageRoot, 'the-art-of-eyelang.md'), 'utf8');
|
|
1758
1758
|
return documentedBuiltinNames(between(book, '<!-- eyelang-library-catalog:start -->', '<!-- eyelang-library-catalog:end -->'), 1);
|
|
1759
1759
|
}
|
|
@@ -1925,7 +1925,7 @@ function markdownLinkTargets(text) {
|
|
|
1925
1925
|
|
|
1926
1926
|
function bookIntroOutputIssues() {
|
|
1927
1927
|
const book = fs.readFileSync(path.join(packageRoot, 'the-art-of-eyelang.md'), 'utf8');
|
|
1928
|
-
const match = book.match(/The (?:first|
|
|
1928
|
+
const match = book.match(/The (?:first|Eyelang) command should print:\s*```text\n([\s\S]*?)```/);
|
|
1929
1929
|
if (match == null) return ['the-art-of-eyelang.md: introductory output block not found'];
|
|
1930
1930
|
const documented = `${match[1].trimEnd()}\n`;
|
|
1931
1931
|
const expected = fs.readFileSync(path.join(packageRoot, 'examples', 'output', 'socrates.pl'), 'utf8');
|