eyeprolog 1.1.1 → 1.1.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/conformance-report.md +2 -2
- package/package.json +1 -1
- package/src/dcg.js +4 -0
- package/test/conformance/ISO-MATRIX.md +1 -1
- package/test/conformance/README.md +3 -3
- package/test/conformance/THIRD_PARTY.md +7 -0
- package/test/conformance/cases/iso/dcg_ambiguous_alternatives.pl +8 -0
- package/test/conformance/cases/iso/dcg_declaration_nonterminal_indicators.pl +7 -0
- package/test/conformance/cases/iso/dcg_double_quotes_atom.pl +7 -0
- package/test/conformance/cases/iso/dcg_double_quotes_codes.pl +6 -0
- package/test/conformance/cases/iso/dcg_dynamic_body_control.pl +15 -0
- package/test/conformance/cases/iso/dcg_dynamic_nonterminal_indicator.pl +7 -0
- package/test/conformance/cases/iso/dcg_explicit_qualified_head.pl +6 -0
- package/test/conformance/cases/iso/dcg_nested_phrase_call.pl +6 -0
- package/test/conformance/cases/iso/dcg_operator_table.pl +5 -0
- package/test/conformance/cases/iso/dcg_partial_sequences.pl +12 -0
- package/test/conformance/cases/iso/dcg_phrase_steadfastness.pl +14 -0
- package/test/conformance/cases/iso/dcg_qualified_chain.pl +10 -0
- package/test/conformance/cases/iso/dcg_recursive_sequences.pl +8 -0
- package/test/conformance/cases/iso/dcg_variable_hygiene.pl +9 -0
- package/test/conformance/cases/iso/logtalk_dcg_conjunction_disjunction.pl +14 -0
- package/test/conformance/cases/iso/logtalk_dcg_cut.pl +12 -0
- package/test/conformance/cases/iso/logtalk_dcg_cut_positions.pl +13 -0
- package/test/conformance/cases/iso/logtalk_dcg_embedded_goals.pl +12 -0
- package/test/conformance/cases/iso/logtalk_dcg_embedded_sequences.pl +10 -0
- package/test/conformance/cases/iso/logtalk_dcg_graphic_nonterminal.pl +7 -0
- package/test/conformance/cases/iso/logtalk_dcg_if_then_else.pl +15 -0
- package/test/conformance/cases/iso/logtalk_dcg_negation_positions.pl +11 -0
- package/test/conformance/cases/iso/logtalk_dcg_nonterminals.pl +11 -0
- package/test/conformance/cases/iso/logtalk_dcg_phrase_identity.pl +12 -0
- package/test/conformance/cases/iso/logtalk_dcg_semicontext_variants.pl +12 -0
- package/test/conformance/cases/iso/logtalk_dcg_semicontexts.pl +12 -0
- package/test/conformance/cases/iso/logtalk_dcg_terminal_variables.pl +9 -0
- package/test/conformance/cases/iso/logtalk_dcg_terminals.pl +15 -0
- package/test/conformance/cases/iso/logtalk_dcg_variable_bodies.pl +10 -0
- package/test/conformance/errors/iso/dcg_call_noncallable.pl +3 -0
- package/test/conformance/errors/iso/dcg_call_variable.pl +3 -0
- package/test/conformance/errors/iso/dcg_nonatom_qualified_module.pl +3 -0
- package/test/conformance/errors/iso/dcg_partial_semicontext.pl +3 -0
- package/test/conformance/errors/iso/dcg_phrase_nonterminal_variable.pl +3 -0
- package/test/conformance/errors/iso/dcg_qualified_unknown_nonterminal.pl +4 -0
- package/test/conformance/errors/iso/dcg_variable_qualified_module.pl +3 -0
- package/test/conformance/errors/iso/dcg_variable_rule_body.pl +3 -0
- package/test/conformance/errors/iso/dcg_variable_rule_head.pl +3 -0
- package/test/conformance/errors/iso/logtalk_dcg_bad_input_precedence.pl +2 -0
- package/test/conformance/errors/iso/logtalk_dcg_bad_output_precedence.pl +2 -0
- package/test/conformance/errors/iso/logtalk_dcg_curly_head.pl +3 -0
- package/test/conformance/errors/iso/logtalk_dcg_cut_head.pl +3 -0
- package/test/conformance/errors/iso/logtalk_dcg_embedded_noncallable.pl +2 -0
- package/test/conformance/errors/iso/logtalk_dcg_improper_semicontext.pl +3 -0
- package/test/conformance/errors/iso/logtalk_dcg_improper_terminal_rule.pl +3 -0
- package/test/conformance/errors/iso/logtalk_dcg_invalid_semicontext.pl +3 -0
- package/test/conformance/errors/iso/logtalk_dcg_multiple_semicontexts.pl +3 -0
- package/test/conformance/errors/iso/logtalk_dcg_nested_noncallable.pl +2 -0
- package/test/conformance/errors/iso/logtalk_dcg_noncallable_after_failure.pl +2 -0
- package/test/conformance/errors/iso/logtalk_dcg_noncallable_after_success.pl +2 -0
- package/test/conformance/errors/iso/logtalk_dcg_noncallable_precedence.pl +2 -0
- package/test/conformance/errors/iso/logtalk_dcg_numeric_head.pl +3 -0
- package/test/conformance/errors/iso/logtalk_dcg_numeric_nonterminal.pl +3 -0
- package/test/conformance/errors/iso/logtalk_dcg_partial_terminal_rule.pl +4 -0
- package/test/conformance/errors/iso/logtalk_dcg_phrase_curly_variable.pl +2 -0
- package/test/conformance/errors/iso/logtalk_dcg_phrase_improper_input.pl +2 -0
- package/test/conformance/errors/iso/logtalk_dcg_phrase_improper_output.pl +2 -0
- package/test/conformance/errors/iso/logtalk_dcg_reversed_semicontext.pl +3 -0
- package/test/conformance/errors/iso/logtalk_dcg_terminal_head.pl +3 -0
- package/test/conformance/errors/iso/logtalk_dcg_unknown_nonterminal.pl +2 -0
- package/test/conformance/expected/iso/dcg_ambiguous_alternatives.pl +1 -0
- package/test/conformance/expected/iso/dcg_declaration_nonterminal_indicators.pl +1 -0
- package/test/conformance/expected/iso/dcg_double_quotes_atom.pl +1 -0
- package/test/conformance/expected/iso/dcg_double_quotes_codes.pl +1 -0
- package/test/conformance/expected/iso/dcg_dynamic_body_control.pl +5 -0
- package/test/conformance/expected/iso/dcg_dynamic_nonterminal_indicator.pl +1 -0
- package/test/conformance/expected/iso/dcg_explicit_qualified_head.pl +1 -0
- package/test/conformance/expected/iso/dcg_nested_phrase_call.pl +1 -0
- package/test/conformance/expected/iso/dcg_operator_table.pl +2 -0
- package/test/conformance/expected/iso/dcg_partial_sequences.pl +3 -0
- package/test/conformance/expected/iso/dcg_phrase_steadfastness.pl +4 -0
- package/test/conformance/expected/iso/dcg_qualified_chain.pl +2 -0
- package/test/conformance/expected/iso/dcg_recursive_sequences.pl +3 -0
- package/test/conformance/expected/iso/dcg_variable_hygiene.pl +2 -0
- package/test/conformance/expected/iso/logtalk_dcg_conjunction_disjunction.pl +8 -0
- package/test/conformance/expected/iso/logtalk_dcg_cut.pl +4 -0
- package/test/conformance/expected/iso/logtalk_dcg_cut_positions.pl +4 -0
- package/test/conformance/expected/iso/logtalk_dcg_embedded_goals.pl +4 -0
- package/test/conformance/expected/iso/logtalk_dcg_embedded_sequences.pl +3 -0
- package/test/conformance/expected/iso/logtalk_dcg_graphic_nonterminal.pl +1 -0
- package/test/conformance/expected/iso/logtalk_dcg_if_then_else.pl +7 -0
- package/test/conformance/expected/iso/logtalk_dcg_negation_positions.pl +4 -0
- package/test/conformance/expected/iso/logtalk_dcg_nonterminals.pl +3 -0
- package/test/conformance/expected/iso/logtalk_dcg_phrase_identity.pl +6 -0
- package/test/conformance/expected/iso/logtalk_dcg_semicontext_variants.pl +4 -0
- package/test/conformance/expected/iso/logtalk_dcg_semicontexts.pl +4 -0
- package/test/conformance/expected/iso/logtalk_dcg_terminal_variables.pl +3 -0
- package/test/conformance/expected/iso/logtalk_dcg_terminals.pl +6 -0
- package/test/conformance/expected/iso/logtalk_dcg_variable_bodies.pl +4 -0
- package/test/conformance/expected-errors/iso/dcg_call_noncallable.txt +1 -0
- package/test/conformance/expected-errors/iso/dcg_call_variable.txt +1 -0
- package/test/conformance/expected-errors/iso/dcg_nonatom_qualified_module.txt +1 -0
- package/test/conformance/expected-errors/iso/dcg_partial_semicontext.txt +1 -0
- package/test/conformance/expected-errors/iso/dcg_phrase_nonterminal_variable.txt +1 -0
- package/test/conformance/expected-errors/iso/dcg_qualified_unknown_nonterminal.txt +1 -0
- package/test/conformance/expected-errors/iso/dcg_variable_qualified_module.txt +1 -0
- package/test/conformance/expected-errors/iso/dcg_variable_rule_body.txt +1 -0
- package/test/conformance/expected-errors/iso/dcg_variable_rule_head.txt +1 -0
- package/test/conformance/expected-errors/iso/logtalk_dcg_bad_input_precedence.txt +1 -0
- package/test/conformance/expected-errors/iso/logtalk_dcg_bad_output_precedence.txt +1 -0
- package/test/conformance/expected-errors/iso/logtalk_dcg_curly_head.txt +1 -0
- package/test/conformance/expected-errors/iso/logtalk_dcg_cut_head.txt +1 -0
- package/test/conformance/expected-errors/iso/logtalk_dcg_embedded_noncallable.txt +1 -0
- package/test/conformance/expected-errors/iso/logtalk_dcg_improper_semicontext.txt +1 -0
- package/test/conformance/expected-errors/iso/logtalk_dcg_improper_terminal_rule.txt +1 -0
- package/test/conformance/expected-errors/iso/logtalk_dcg_invalid_semicontext.txt +1 -0
- package/test/conformance/expected-errors/iso/logtalk_dcg_multiple_semicontexts.txt +1 -0
- package/test/conformance/expected-errors/iso/logtalk_dcg_nested_noncallable.txt +1 -0
- package/test/conformance/expected-errors/iso/logtalk_dcg_noncallable_after_failure.txt +1 -0
- package/test/conformance/expected-errors/iso/logtalk_dcg_noncallable_after_success.txt +1 -0
- package/test/conformance/expected-errors/iso/logtalk_dcg_noncallable_precedence.txt +1 -0
- package/test/conformance/expected-errors/iso/logtalk_dcg_numeric_head.txt +1 -0
- package/test/conformance/expected-errors/iso/logtalk_dcg_numeric_nonterminal.txt +1 -0
- package/test/conformance/expected-errors/iso/logtalk_dcg_partial_terminal_rule.txt +1 -0
- package/test/conformance/expected-errors/iso/logtalk_dcg_phrase_curly_variable.txt +1 -0
- package/test/conformance/expected-errors/iso/logtalk_dcg_phrase_improper_input.txt +1 -0
- package/test/conformance/expected-errors/iso/logtalk_dcg_phrase_improper_output.txt +1 -0
- package/test/conformance/expected-errors/iso/logtalk_dcg_reversed_semicontext.txt +1 -0
- package/test/conformance/expected-errors/iso/logtalk_dcg_terminal_head.txt +1 -0
- package/test/conformance/expected-errors/iso/logtalk_dcg_unknown_nonterminal.txt +1 -0
- package/the-art-of-eyeprolog.md +1 -1
package/conformance-report.md
CHANGED
|
@@ -11,7 +11,7 @@ This report summarizes the file-based conformance corpus under `test/conformance
|
|
|
11
11
|
| builtins | 11 | 0 | 0 | 0 | 11 |
|
|
12
12
|
| context | 11 | 0 | 0 | 0 | 11 |
|
|
13
13
|
| control | 15 | 0 | 0 | 0 | 15 |
|
|
14
|
-
| iso |
|
|
14
|
+
| iso | 164 | 209 | 0 | 0 | 373 |
|
|
15
15
|
| lists | 52 | 3 | 0 | 0 | 55 |
|
|
16
16
|
| modules | 2 | 0 | 0 | 0 | 2 |
|
|
17
17
|
| negation | 8 | 0 | 19 | 0 | 27 |
|
|
@@ -23,4 +23,4 @@ This report summarizes the file-based conformance corpus under `test/conformance
|
|
|
23
23
|
| terms | 26 | 3 | 0 | 0 | 29 |
|
|
24
24
|
| unification | 18 | 0 | 0 | 0 | 18 |
|
|
25
25
|
| variables | 16 | 9 | 0 | 0 | 25 |
|
|
26
|
-
| **Total** | **
|
|
26
|
+
| **Total** | **479** | **260** | **19** | **21** | **779** |
|
package/package.json
CHANGED
package/src/dcg.js
CHANGED
|
@@ -96,6 +96,10 @@ export function expandDcgBody(body, input, output, options = {}) {
|
|
|
96
96
|
return goal;
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
+
// Empty braces are the empty embedded-goal sequence. Like {true}, they
|
|
100
|
+
// consume no terminals and leave the grammar state unchanged.
|
|
101
|
+
if (body.type === ATOM && body.name === '{}') return equality(input, output);
|
|
102
|
+
|
|
99
103
|
if (isTerminalSequence(body)) return terminalsGoal(body, input, output, env);
|
|
100
104
|
|
|
101
105
|
if (body.type === COMPOUND && body.name === ',' && body.arity === 2) {
|
|
@@ -19,7 +19,7 @@ case totals.
|
|
|
19
19
|
| 8.17 flags and hooks | required flags, mutation permissions, halt and character conversion | `exceptions_and_flags`, `remaining_builtins_and_directives`, flag error cases |
|
|
20
20
|
| Clause 9 evaluable functors | integer, float, rounding, transcendental and bitwise operations | `arithmetic`, `corrigenda_arithmetic`, `corrigenda_atan2_zero`, `corrigenda_integer_negative_power` |
|
|
21
21
|
| ISO/IEC 13211-2 modules | module declarations, exports, imports, qualification, meta-predicate context | `modules/qualified_call`, `modules/selective_library_import`, `dcg_module_nonterminal_indicator` |
|
|
22
|
-
| ISO/IEC TS 13211-3 grammar rules | `-->`, terminal sequences, grammar control constructs, semicontexts, nonterminal indicators, `phrase/2-3
|
|
22
|
+
| ISO/IEC TS 13211-3 grammar rules | `-->`, 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 |
|
|
23
23
|
|
|
24
24
|
Corrigendum-specific coverage includes double-quoted atom operator priority
|
|
25
25
|
(Cor.1); the added predicates and evaluable functors, bar-operator rules,
|
|
@@ -90,11 +90,11 @@ ISO/IEC 13211-1 clauses 7 and 8. In particular, isolated negative cases keep
|
|
|
90
90
|
instantiation, type, domain, permission, representation, and evaluation errors
|
|
91
91
|
independently observable.
|
|
92
92
|
|
|
93
|
-
Selected cases are adapted from the ISO and standard-core suites of
|
|
94
|
-
Prolog, Trealla Prolog, and SWI-Prolog. Their upstream identifiers and licenses
|
|
93
|
+
Selected cases are adapted from the ISO and standard-core suites of Logtalk,
|
|
94
|
+
Scryer Prolog, Trealla Prolog, and SWI-Prolog. Their upstream identifiers and licenses
|
|
95
95
|
are recorded in [THIRD_PARTY.md](THIRD_PARTY.md).
|
|
96
96
|
|
|
97
|
-
The corpus has
|
|
97
|
+
The corpus has 373 cases in `iso/` and 779 file-based conformance cases in
|
|
98
98
|
total. The generated `conformance-report.md` is the authoritative source for
|
|
99
99
|
current category totals. Together with regression, documentation-sync, API,
|
|
100
100
|
example, and book-example checks, `npm test` is the release gate.
|
|
@@ -9,6 +9,13 @@ identifies its upstream test names. The cases were rewritten for EyeProlog's
|
|
|
9
9
|
file-based query and exact-output harness and are therefore modified from the
|
|
10
10
|
upstream files.
|
|
11
11
|
|
|
12
|
+
Part 3 grammar cases are additionally adapted from Logtalk's
|
|
13
|
+
`tests/logtalk/methods/phrase_2_3/tests.lgt` and
|
|
14
|
+
`tests/logtalk/dcgs/tests.lgt` suites. Object and unit-test scaffolding was
|
|
15
|
+
removed, translator-only assertions were converted to executable grammar
|
|
16
|
+
behavior where possible, and expected list errors follow the Part 3
|
|
17
|
+
`terminal_sequence` terminology used by EyeProlog.
|
|
18
|
+
|
|
12
19
|
Copyright 1998-2026 Paulo Moura <pmoura@logtalk.org>
|
|
13
20
|
|
|
14
21
|
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
% phrase/2 expands dynamically constructed grammar bodies using static semantics.
|
|
2
|
+
%% goal: dynamic_body(X0, X1)
|
|
3
|
+
|
|
4
|
+
dynamic_body(sequence, Tokens) :-
|
|
5
|
+
Body = ([a], [b]),
|
|
6
|
+
phrase(Body, Tokens).
|
|
7
|
+
dynamic_body(choice, Tokens) :-
|
|
8
|
+
Body = ([a]; [b]),
|
|
9
|
+
phrase(Body, Tokens).
|
|
10
|
+
dynamic_body(embedded, Tokens) :-
|
|
11
|
+
Body = ({true}, [ok]),
|
|
12
|
+
phrase(Body, Tokens).
|
|
13
|
+
dynamic_body(conditional, Tokens) :-
|
|
14
|
+
Body = ([x] -> [yes]; [no]),
|
|
15
|
+
phrase(Body, Tokens).
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
% Part 3 phrase/3 accepts partial terminal sequences and preserves their tail.
|
|
2
|
+
%% goal: partial_sequence(X0)
|
|
3
|
+
|
|
4
|
+
partial_sequence(one) :-
|
|
5
|
+
phrase([a], [a|Tail], Tail),
|
|
6
|
+
Tail = [rest].
|
|
7
|
+
partial_sequence(two) :-
|
|
8
|
+
phrase([a, b], [a, b|Tail], Tail),
|
|
9
|
+
Tail = [rest].
|
|
10
|
+
partial_sequence(empty) :-
|
|
11
|
+
phrase([], Tail, Tail),
|
|
12
|
+
Tail = [rest].
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
% phrase/3 is steadfast in its third argument.
|
|
2
|
+
%% goal: steadfast(X0)
|
|
3
|
+
|
|
4
|
+
steadfast(bound_before) :-
|
|
5
|
+
Rest = [b],
|
|
6
|
+
phrase([a], [a, b], Rest).
|
|
7
|
+
steadfast(bound_after) :-
|
|
8
|
+
phrase([a], [a, b], Rest),
|
|
9
|
+
Rest = [b].
|
|
10
|
+
steadfast(selects_matching_alternative) :-
|
|
11
|
+
phrase(([a]; [a, b]), [a, b], [b]).
|
|
12
|
+
steadfast(shared_sequence) :-
|
|
13
|
+
phrase([], Sequence, Sequence),
|
|
14
|
+
Sequence = [same].
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
% Qualified nonterminals retain module context through nested phrase//1 calls.
|
|
2
|
+
:- module(dcg_chain, [leaf//0, branch//0, wrapper//0, answer/1]).
|
|
3
|
+
|
|
4
|
+
leaf --> [x].
|
|
5
|
+
branch --> dcg_chain:leaf.
|
|
6
|
+
wrapper --> phrase(dcg_chain:branch).
|
|
7
|
+
answer(Tokens) :- phrase(wrapper, Tokens).
|
|
8
|
+
|
|
9
|
+
%% goal: dcg_chain:answer(Tokens)
|
|
10
|
+
%% goal: phrase(dcg_chain:wrapper, Tokens)
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
% Recursive grammar rules support both recognition and generation.
|
|
2
|
+
|
|
3
|
+
tokens([]) --> [].
|
|
4
|
+
tokens([X|Xs]) --> [X], tokens(Xs).
|
|
5
|
+
|
|
6
|
+
%% goal: phrase(tokens([a, b, c]), Generated)
|
|
7
|
+
%% goal: phrase(tokens(Parsed), [x, y])
|
|
8
|
+
%% goal: phrase(tokens([a, b]), [a, b, rest], Rest)
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
% Generated state variables must not capture similarly named source variables.
|
|
2
|
+
|
|
3
|
+
capture_states(S0, S, Input, Output) -->
|
|
4
|
+
[S0, S],
|
|
5
|
+
{Input = source_input, Output = source_output}.
|
|
6
|
+
anonymous_pair --> [_, _].
|
|
7
|
+
|
|
8
|
+
%% goal: phrase(capture_states(A, B, Input, Output), [left, right])
|
|
9
|
+
%% goal: phrase(anonymous_pair, [one, two])
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
% Adapted from Logtalk dcgs_conjunction_01-04 and dcgs_disjunction_01-03.
|
|
2
|
+
% Modified for EyeProlog's harness. See test/conformance/THIRD_PARTY.md.
|
|
3
|
+
|
|
4
|
+
a --> [a].
|
|
5
|
+
b --> [b].
|
|
6
|
+
sequence --> a, b.
|
|
7
|
+
optional_b --> a, (b; []).
|
|
8
|
+
bar_choice --> [x] | [y] | [z].
|
|
9
|
+
nested_choice --> ([a], [b]; [a], [c]).
|
|
10
|
+
|
|
11
|
+
%% goal: phrase(sequence, X)
|
|
12
|
+
%% goal: phrase(optional_b, X)
|
|
13
|
+
%% goal: phrase(bar_choice, X)
|
|
14
|
+
%% goal: phrase(nested_choice, X)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
% Adapted from Logtalk dcgs_cut_01-06. Modified for EyeProlog's harness.
|
|
2
|
+
% See test/conformance/THIRD_PARTY.md.
|
|
3
|
+
%% goal: cut_result(X0, X1)
|
|
4
|
+
|
|
5
|
+
committed --> ([a], ! ; [b]).
|
|
6
|
+
cut_then_fail --> ([a], !, {fail} ; [b]).
|
|
7
|
+
cut_after_prefix --> [start], ([a], ! ; [b]).
|
|
8
|
+
|
|
9
|
+
cut_result(committed, Tokens) :- phrase(committed, Tokens).
|
|
10
|
+
cut_result(fallback_before_cut, [b]) :- phrase(cut_then_fail, [b]).
|
|
11
|
+
cut_result(failure_after_cut, preserved) :- \+ phrase(cut_then_fail, [a]).
|
|
12
|
+
cut_result(nested, Tokens) :- phrase(cut_after_prefix, Tokens).
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
% Adapted from Logtalk dcgs_cut_01-04 and 06.
|
|
2
|
+
% Modified for EyeProlog's harness. See test/conformance/THIRD_PARTY.md.
|
|
3
|
+
%% goal: cut_position(X0, X1)
|
|
4
|
+
|
|
5
|
+
cut_first --> !, [a].
|
|
6
|
+
cut_middle --> [a], !, [b].
|
|
7
|
+
cut_choice --> ([a], !, [b] ; [a], [c]).
|
|
8
|
+
cut_embedded_failure --> [a], !, {fail}.
|
|
9
|
+
|
|
10
|
+
cut_position(first, Tokens) :- phrase(cut_first, Tokens).
|
|
11
|
+
cut_position(middle, Tokens) :- phrase(cut_middle, Tokens).
|
|
12
|
+
cut_position(choice, Tokens) :- phrase(cut_choice, Tokens).
|
|
13
|
+
cut_position(failure, preserved) :- \+ phrase(cut_embedded_failure, [a]).
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
% Adapted from Logtalk dcgs_bypass_01 and 03-10.
|
|
2
|
+
% Modified for EyeProlog's harness. See test/conformance/THIRD_PARTY.md.
|
|
3
|
+
|
|
4
|
+
checked(X) --> [X], {atom(X)}.
|
|
5
|
+
bind(X) --> {X = bound}.
|
|
6
|
+
embedded_sequence(X) --> {X = a, atom(X)}, [X].
|
|
7
|
+
embedded_if --> ({true} -> [yes] ; [no]).
|
|
8
|
+
|
|
9
|
+
%% goal: phrase(checked(token), [token])
|
|
10
|
+
%% goal: phrase(bind(X), [])
|
|
11
|
+
%% goal: phrase(embedded_sequence(X), Tokens)
|
|
12
|
+
%% goal: phrase(embedded_if, Tokens)
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
% Adapted from Logtalk dcgs_bypass_03-05 and 10.
|
|
2
|
+
% Modified for EyeProlog's harness. See test/conformance/THIRD_PARTY.md.
|
|
3
|
+
|
|
4
|
+
three_checks(X) --> {X = a}, {atom(X)}, {X == a}, [X].
|
|
5
|
+
grouped_checks(X) --> {X = b, atom(X)}, [X].
|
|
6
|
+
embedded_choice --> ({fail}; {true}), [ok].
|
|
7
|
+
|
|
8
|
+
%% goal: phrase(three_checks(X), Tokens)
|
|
9
|
+
%% goal: phrase(grouped_checks(X), Tokens)
|
|
10
|
+
%% goal: phrase(embedded_choice, Tokens)
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
% Adapted from Logtalk dcgs_if_the_else_01-06 and dcgs_bypass_06-07.
|
|
2
|
+
% Modified for EyeProlog's harness. See test/conformance/THIRD_PARTY.md.
|
|
3
|
+
|
|
4
|
+
select --> ([x] -> [then] ; [else]).
|
|
5
|
+
after_prefix --> [start], ([x] -> [yes] ; [no]).
|
|
6
|
+
condition_sequence --> ([a], [b] -> [c] ; [d]).
|
|
7
|
+
embedded_condition --> ({true} -> [yes] ; [no]).
|
|
8
|
+
|
|
9
|
+
%% goal: phrase(select, [x, then])
|
|
10
|
+
%% goal: phrase(select, [else])
|
|
11
|
+
%% goal: phrase(after_prefix, [start, x, yes])
|
|
12
|
+
%% goal: phrase(after_prefix, [start, no])
|
|
13
|
+
%% goal: phrase(condition_sequence, [a, b, c])
|
|
14
|
+
%% goal: phrase(condition_sequence, [d])
|
|
15
|
+
%% goal: phrase(embedded_condition, X)
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
% Adapted from Logtalk dcgs_negation_01-02.
|
|
2
|
+
% Modified for EyeProlog's harness. See test/conformance/THIRD_PARTY.md.
|
|
3
|
+
%% goal: negation_result(X0, X1)
|
|
4
|
+
|
|
5
|
+
not_b --> \+ [b], [_].
|
|
6
|
+
middle_not_x --> [a], \+ [x], [_].
|
|
7
|
+
|
|
8
|
+
negation_result(prefix_success, a) :- phrase(not_b, [a]).
|
|
9
|
+
negation_result(prefix_failure, preserved) :- \+ phrase(not_b, [b]).
|
|
10
|
+
negation_result(middle_success, [a, b]) :- phrase(middle_not_x, [a, b]).
|
|
11
|
+
negation_result(middle_failure, preserved) :- \+ phrase(middle_not_x, [a, x]).
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
% Adapted from Logtalk dcgs_non_terminal_01-03 and dcgs_metacall_01-02.
|
|
2
|
+
% Modified for EyeProlog's harness. See test/conformance/THIRD_PARTY.md.
|
|
3
|
+
|
|
4
|
+
token(X) --> [X].
|
|
5
|
+
pair(X, Y) --> token(X), token(Y).
|
|
6
|
+
delegate(Body) --> Body.
|
|
7
|
+
via_call(X) --> call(token(X)).
|
|
8
|
+
|
|
9
|
+
%% goal: phrase(pair(a, b), X)
|
|
10
|
+
%% goal: phrase(delegate([x, y]), X)
|
|
11
|
+
%% goal: phrase(via_call(z), X)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
% Adapted from Logtalk phrase_3_15 through 21. Modified for EyeProlog's harness.
|
|
2
|
+
% See test/conformance/THIRD_PARTY.md.
|
|
3
|
+
%% goal: phrase_identity(X0, X1)
|
|
4
|
+
|
|
5
|
+
phrase_identity(empty_braces, Rest) :- phrase({}, [tail], Rest).
|
|
6
|
+
phrase_identity(true_goal, Rest) :- phrase({true}, [tail], Rest).
|
|
7
|
+
phrase_identity(cut, Rest) :- phrase(!, [tail], Rest).
|
|
8
|
+
phrase_identity(terminals, Input) :- phrase([a, b], Input, []).
|
|
9
|
+
phrase_identity(suffix, Input) :- phrase([a, b], Input, [b]).
|
|
10
|
+
phrase_identity(committed_failures, preserved) :-
|
|
11
|
+
\+ phrase({!, fail}, [], []),
|
|
12
|
+
\+ phrase(({!, fail}; {true}), [], []).
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
% Adapted from Logtalk dcgs_push_back_list_02-06.
|
|
2
|
+
% Modified for EyeProlog's harness. See test/conformance/THIRD_PARTY.md.
|
|
3
|
+
|
|
4
|
+
push_two, [a, b] --> [].
|
|
5
|
+
consume_then_push, [tail] --> [head], [middle].
|
|
6
|
+
echo(X), [X] --> [X].
|
|
7
|
+
echo_pair(X, Y), [X, Y] --> [X, Y].
|
|
8
|
+
|
|
9
|
+
%% goal: phrase(push_two, [rest], Rest)
|
|
10
|
+
%% goal: phrase(consume_then_push, [head, middle, rest], Rest)
|
|
11
|
+
%% goal: phrase(echo(x), [x, rest], Rest)
|
|
12
|
+
%% goal: phrase(echo_pair(a, b), [a, b, rest], Rest)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
% Adapted from Logtalk dcgs_push_back_list_01-08.
|
|
2
|
+
% Modified for EyeProlog's harness. See test/conformance/THIRD_PARTY.md.
|
|
3
|
+
|
|
4
|
+
look_ahead(X), [X] --> [X].
|
|
5
|
+
replace, [a, b] --> [foo].
|
|
6
|
+
push_one(X), [X] --> [X].
|
|
7
|
+
push_pair(X, Y), [X, Y] --> [X, Y].
|
|
8
|
+
|
|
9
|
+
%% goal: phrase(look_ahead(a), [a], Rest)
|
|
10
|
+
%% goal: phrase(replace, [foo, tail], Rest)
|
|
11
|
+
%% goal: phrase(push_one(x), [x], Rest)
|
|
12
|
+
%% goal: phrase(push_pair(a, b), [a, b], Rest)
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
% Adapted from Logtalk dcgs_terminal_list_05-06.
|
|
2
|
+
% Modified for EyeProlog's harness. See test/conformance/THIRD_PARTY.md.
|
|
3
|
+
|
|
4
|
+
capture(X) --> [X].
|
|
5
|
+
duplicate(X) --> [X, X].
|
|
6
|
+
|
|
7
|
+
%% goal: phrase(capture(X), [term(a)])
|
|
8
|
+
%% goal: phrase(capture(value), Tokens)
|
|
9
|
+
%% goal: phrase(duplicate(same), Tokens)
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
% Adapted from Logtalk dcgs_terminal_list_01-06 and
|
|
2
|
+
% dcgs_terminal_string_01-03. Modified for EyeProlog's harness.
|
|
3
|
+
% See test/conformance/THIRD_PARTY.md.
|
|
4
|
+
|
|
5
|
+
empty --> [].
|
|
6
|
+
one(X) --> [X].
|
|
7
|
+
mixed --> [[], {}, 3, 3.2, a(b)].
|
|
8
|
+
letters --> "abc".
|
|
9
|
+
letters_or_q --> "abc" | "q".
|
|
10
|
+
|
|
11
|
+
%% goal: phrase(empty, [])
|
|
12
|
+
%% goal: phrase(one(value), [value])
|
|
13
|
+
%% goal: phrase(mixed, [[], {}, 3, 3.2, a(b)])
|
|
14
|
+
%% goal: phrase(letters, X)
|
|
15
|
+
%% goal: phrase(letters_or_q, X)
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
% Adapted from Logtalk dcgs_metacall_01-02.
|
|
2
|
+
% Modified for EyeProlog's harness. See test/conformance/THIRD_PARTY.md.
|
|
3
|
+
|
|
4
|
+
delegate(Body) --> Body.
|
|
5
|
+
surrounded(Body) --> [left], Body, [right].
|
|
6
|
+
body_or_fallback(Body) --> Body | [fallback].
|
|
7
|
+
|
|
8
|
+
%% goal: phrase(delegate([a, b]), Tokens)
|
|
9
|
+
%% goal: phrase(surrounded([center]), Tokens)
|
|
10
|
+
%% goal: phrase(body_or_fallback([chosen]), Tokens)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ambiguity([first, second]).
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
phrase(shared, "x").
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
phrase(uses_atom_body, [recognized]).
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
phrase(codes, "ab").
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
dynamic_nonterminal(asserted).
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
phrase(dcg_explicit:word, "x").
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
phrase(outer, "iio").
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
graphic_nonterminal(open).
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
error(type_error(callable), 1)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
error(instantiation_error)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
error(type_error(atom), 1)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
error(instantiation_error)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
error(instantiation_error)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
error(existence_error(procedure), /(absent, 2))
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
error(instantiation_error)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
error(instantiation_error)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
error(instantiation_error)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
error(type_error(terminal_sequence), not_a_terminal_sequence)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
error(type_error(terminal_sequence), not_a_terminal_sequence)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
error(permission_error(define, grammar_rule), {goal})
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
error(permission_error(define, grammar_rule), !)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
error(type_error(callable), 1)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
error(type_error(terminal_sequence), [a | b])
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
error(type_error(terminal_sequence), [a | b])
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
error(type_error(terminal_sequence), b)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
parse line 2: expected ., got ,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
error(type_error(callable), 1)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
error(type_error(callable), 1)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
error(type_error(callable), 1)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
error(type_error(callable), 1)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
error(type_error(callable), 3)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
error(type_error(callable), 3)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
error(instantiation_error)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
error(instantiation_error)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
error(type_error(terminal_sequence), [a | b])
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
error(type_error(terminal_sequence), [a | b])
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
error(permission_error(define, grammar_rule), "t")
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
error(permission_error(define, grammar_rule), "t")
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
error(existence_error(procedure), /(foo, 2))
|
package/the-art-of-eyeprolog.md
CHANGED
|
@@ -6606,7 +6606,7 @@ node test/run-conformance-report.mjs
|
|
|
6606
6606
|
```
|
|
6607
6607
|
|
|
6608
6608
|
The complete suite must pass before release. The file-based conformance corpus
|
|
6609
|
-
contains
|
|
6609
|
+
contains 779 cases, including 373 focused ISO
|
|
6610
6610
|
cases derived from the success, failure, mode, and error behavior in
|
|
6611
6611
|
ISO/IEC 13211-1 clauses 7 and 8, Part 2 modules, and Part 3 grammar rules.
|
|
6612
6612
|
Separate exact-output suites check 189 normal
|