Markus Triska
a6ccf95076
improve error context
...
Source: https://github.com/mthom/scryer-prolog/issues/2304#issuecomment-1906434756
2024-01-23 21:43:34 +01:00
Markus Triska
fe3241c07c
remove checks that are now no longer needed due to representation errors
2024-01-21 10:28:19 +01:00
Markus Triska
0559ddca2a
ENHANCED: Throw representation errors for DCG bodies that use unsupported constructs.
...
This addresses #2285 .
2024-01-21 10:28:19 +01:00
Markus Triska
98a046500f
MODIFIED: (->)/2 in DCGs is now only supported in the context of if-then-else.
...
That is, ( If -> Then ; Else ) is still supported, but ( If -> Then ) not.
2024-01-21 10:28:19 +01:00
Markus Triska
e702fe5c68
ADDED: Support for higher-order non-terminals phrase//[2,3]
...
These non-terminals take a grammar rule body and additional arguments
as arguments. These arguments are appended to the first argument.
A key motivation for the introduction of these non-terminals is found
in the discussion and sample code provided by @bakaq in:
https://github.com/mthom/scryer-prolog/discussions/2260
In this way, portable higher-order DCG programming is possible while
keeping the logical grammar rule expansion implementation dependent.
Example:
?- phrase(phrase('.', a, []), Cs).
Cs = "a".
2024-01-06 14:02:13 +01:00
Markus Triska
f2b63d1689
Prevent assertion of clauses for (-->)/2 when DCGs are enabled.
...
This addresses #1508 .
2024-01-05 19:04:53 +01:00
Mark
9cd762d88a
remove (\+)//1 ( #1511 )
2023-12-04 13:51:44 -07:00
Mark
2c76943d35
emit callable type errors from call/1 and phrase/3 when appropriate ( #2202 )
2023-12-04 12:20:14 -07:00
Mark Thom
6e9cd072c5
catch attribute_goals errors in copy_term/3, don't discard variable module qualifiers in dcg_body/3 ( #1738 )
2023-02-21 00:50:46 -07:00
Mark Thom
601ff567e3
keep phrase goal qualified even if qualifier is a variable
2023-02-17 00:20:15 -07:00
Adrián Arroyo Calle
7f177c3d03
Compatible Doclog docs for library(dcgs)
2023-01-23 21:03:11 +01:00
Markus Triska
76e33d051c
rely on the built-in DCG expansion, per discussion in #1577
2022-10-26 23:36:07 -06:00
Markus Triska
47892bf24a
ENHANCED: Improve determinism of ... //0 and seq//1.
...
Example:
?- phrase(..., "hello").
true.
This addresses #1577 .
2022-10-26 23:36:07 -06:00
Mark Thom
4e6c138099
introduce expand_call_goal/3 to expand goals in control meta-predicates ( #1568 )
2022-10-26 23:36:07 -06:00
Mark Thom
78278c804f
strip modules from GRBody in phrase/3 ( #1565 )
2022-10-26 23:36:07 -06:00
Mark Thom
b8f384045c
fix module resolution in dcgs, call/N ( #1539 )
2022-10-26 23:36:07 -06:00
Mark Thom
1ffbf63d20
inline metacalls
2022-10-26 23:36:07 -06:00
Mark Thom
607c84a79b
capture and propagate (=..)/2 errors in phrase/{2,3} ( #1460 )
2022-06-21 22:47:55 -06:00
Mark Thom
0f502fff84
compact lists of characters to partial strings in read_term_from_heap ( #1452 , #1453 )
2022-05-03 19:12:16 -06:00
Mark Thom
e6c4ecfc10
lazily throw exceptions of dcg_body from goal-expanded phrase/{2,3} ( #1244 )
2022-01-22 14:55:18 -07:00
Mark Thom
8df346f377
expand phrase/{2,3} using dcg_body whenever possible
2022-01-21 08:10:55 -07:00
Mark Thom
1854338ff4
throw errors from phrase/{2,3} where expected ( #1220 )
2022-01-19 20:19:47 -07:00
Mark Thom
11b96875e0
streamline and fix phrase/{2,3} ( #1237 )
2022-01-19 20:07:15 -07:00
Mark Thom
0e2db4a23e
tag DCG constructs with module names for proper resolution
2022-01-06 21:44:41 -07:00
Markus Triska
bf9654e138
ADDED: ... //0, describing an arbitrary number of elements
...
This is a very versatile nonterminal. For instance, repeated elements:
?- phrase((...,[E],...,[E],...), "hello!!").
%@ E = l
%@ ; E = !
%@ ; false.
2021-07-03 09:54:01 +02:00
panasenco
02b89362b2
Replaced raw_chars//1 in library(pio) with seq//1 in library(dcgs).
2021-04-25 14:53:37 -07:00
Mark Thom
a8a82e45a0
introduce cuts over indexed (:)/2 of dcgs:phrase_/3 ( #786 )
2021-02-03 16:03:15 -07:00
Mark Thom
94392f248c
enable phrase_ rules for module resolved grammars ( #785 )
2021-02-03 15:48:12 -07:00
Mark Thom
88ad2ee103
restore cut after dcg_constr check ( #784 )
2021-02-03 15:21:20 -07:00
Mark Thom
4e29099ed9
export loader's public predicates from builtins, handle module resolution from DCGs
2021-02-02 15:43:52 -07:00
Mark Thom
8900df6f13
add built_in to predicate_property
2021-02-02 15:03:14 -07:00
Mark Thom
a4d15bfb88
move to a predicate-based module system, move to loader.[rs|pl]-based compilation, add support for incremental clause compilation
2021-01-30 21:07:51 -07:00
Mark Thom
4f15802fbc
reconcile '[]' and [] ( #644 ), solve remaining conformity issues ( #648 ), move (-->) from dcgs.pl to builtins.pl ( #649 )
2020-08-02 23:35:53 -06:00
Mark Thom
33325f1574
remove vestigial prolog/ directory ( #444 )
2020-06-12 18:26:38 -06:00