Commit Graph

125 Commits

Author SHA1 Message Date
Mark Thom
d83827b21f Merge pull request #2746 from triska/quads
preliminary support for a subset of quads introduced by @UWN
2025-08-10 01:36:15 -07:00
Markus Triska
c5fd4c1d8a support newly added representation_error/1 in answer descriptions 2025-08-08 21:34:23 +02:00
Markus Triska
7dc6d6e4e0 preliminary support for a subset of quads introduced by @UWN
This lets us embed toplevel interactions in Prolog programs.
Embedded toplevel interactions are currently ignored.

Example:

   :- use_module(library(lists)).

   ?- member(X, "abc").
      X = a
   ;  X = b
   ;  X = c.
2025-08-08 18:44:25 +02:00
Markus Triska
a8da2b6a99 ISO: remove nonstandard operator meta_predicate.
Use functional notation instead for declarations.

This addresses #2822.
2025-08-02 10:22:50 +02:00
Mark Thom
98dae9aecc do not allow strings containing null characters to be inlined (#2848) 2025-07-07 22:38:12 -07:00
Mark Thom
9e1e99f961 Revert "remove Term"
This reverts commit 3b5879841aedecba5057c70c71da0ba23e5cd84a.
2025-07-07 22:38:10 -07:00
Mark Thom
c0f72704ec introduce bespoke Heap type for in-heap partial strings 2025-07-07 21:59:50 -07:00
Mark Thom
1ef681bd21 remove Term 2025-07-07 21:54:08 -07:00
David Farrell
f509d3d66f Line numbers start at 1
Bumps the line number for the singleton warning. When the singleton
occurs on the same line at the term starts, the line number is correct:

    foo(X).

However it stills mis-reports this line number as 1 instead of 5:

    foo(1) :-
        true,
        true,
        true,
        Y.

See issue #1356.
2025-02-02 08:16:05 -05:00
Emilie Burgun
b76bdd75e4 Fix #2725 by calling load_context/1 in the unspecified branch of strip_module/3
This fixes #2725, by making it so that `strip_module(Pred, M, P), call(M:P)`
doesn't throw an `instanciation_error` when `Pred` isn't in the form `module:predicate`.

Now, `strip_module(hello, M, P)` will call `load_context(M)`, which unifies `M`
with the topmost module (or `user`).

Two new test cases are added: issue2725.pl, which tests the minimal case id(X) --> X.
and the strip_module(P, M, _), call(M:P) scenario, and module_resolution,
which tests the behavior of strip_module in a few scenarios.
2025-01-12 14:08:28 +01:00
Mark Thom
555dff5bad leave variable modules uninstantiated (#2685) 2024-12-19 20:20:29 -08:00
Mark Thom
dba9c9a0a7 instantiate module resolutions for meta-predicate lookups when expanding calls (#2255, #2619, #2684) 2024-12-06 23:30:36 -08:00
Mark Thom
c39ea4818a Merge pull request #2527 from bakaq/leaf_answers_callbacks
Toplevel reimplementation with leaf answer callbacks
2024-10-13 12:13:08 -06:00
Aleksy Grabowski
61c258f49e Fix mistake in predicate indicator 2024-09-06 08:07:21 +02:00
bakaq
9f4d31a825 Toplevel reimplementation with leaf answer callbacks 2024-09-03 13:43:31 -03:00
Mark Thom
c2657cce37 use common test_framework module for several test suites 2024-04-10 15:47:31 -06:00
Mark
0292cb73d3 expand_call_goals/3 should expand meta-predicate subgoals (#2361) 2024-03-19 17:12:26 -06:00
Mark
df41eb1870 recompile original terms from compile_clause for term to term expansions (#2236) 2024-03-01 18:57:01 -07:00
Mark
ccf581d86f expand module names in transitive goals (#2255) 2024-01-02 11:34:38 -07:00
Mark Thom
5c89029462 Merge pull request #2263 from aarroyoc/docs-toplevel
Move argv/1 to library(os)
2024-01-02 09:19:10 -07:00
Adrián Arroyo Calle
47b5ae7984 Move argv/1 to library(os) 2024-01-02 13:16:11 +01:00
bakaq
d9d90d1ae8 Emit warnings as Prolog comments 2023-12-30 17:39:20 -03:00
Mark
2c76943d35 emit callable type errors from call/1 and phrase/3 when appropriate (#2202) 2023-12-04 12:20:14 -07:00
Nicolas Luck
640c637ca8 Merge branch 'master' into library-use-case
# Conflicts:
#	Cargo.lock
#	Cargo.toml
#	src/http.rs
#	src/machine/mock_wam.rs
#	src/machine/mod.rs
#	src/machine/system_calls.rs
2023-10-05 12:06:47 +02:00
Mark
a1ceeb697a consider an '$aux' a relation of the unexpanded goal's variables in compile_inline_or_expanded_goal (#2062) 2023-10-01 23:49:55 -06:00
Mark
f630a8cc1a fix add_predicate_declaration bug not correctly identifying lists of predicate indicators (#2049, #2050, #2051, #2052) 2023-09-27 17:55:15 -06:00
Mark
56992570d8 check for predicate_indicator list and sequence types in add_predicate_declaration (#1586) 2023-09-26 12:54:16 -06:00
Mark
e8334f9b67 add predicate indicator sequences to loader:add_predicate_declaration (#1586) 2023-09-26 11:21:47 -06:00
Mark
c26e9436b4 generalize multifile/dynamic/discontiguous declarations over lists of predicate indicators (#1586) 2023-09-21 16:22:41 -06:00
Nicolas Luck
136463c92e Merge branch 'master' into library-use-case
# Conflicts:
#	Cargo.toml
#	src/atom_table.rs
#	src/bin/scryer-prolog.rs
#	src/http.rs
#	src/machine/mock_wam.rs
#	src/machine/mod.rs
#	src/machine/system_calls.rs
2023-09-13 18:13:14 +02:00
Mark
fa11d6bdd4 remove error printing redundancy and inconsistent state resulting from file_load_cleanup (#1995) 2023-09-05 13:53:57 -06:00
Mark
5585e83fd6 correct inference counting over index backtracking, built-ins (#1977, #1987) 2023-09-04 17:15:16 -06:00
Nicolas Luck
48a4835819 Merge branch 'master' into library-use-case
# Conflicts:
#	Cargo.lock
#	Cargo.toml
#	src/bin/scryer-prolog.rs
#	src/loader.pl
#	src/machine/mock_wam.rs
#	src/machine/mod.rs
#	src/machine/system_calls.rs
2023-08-03 20:16:32 +02:00
Nicolas Luck
2f99bb025c Add consult that works with streams / strings in library use-case 2023-07-27 11:41:52 +02:00
Mark
e529e7ba21 improve goal expansion and (',') interpretation error handling 2023-07-20 14:27:10 -06:00
Mark
b234ef7ea3 use double_quotes in write_error (#1886) 2023-07-15 10:58:25 -06:00
Mark
d7f5675727 improve call/N implementation (#1829) 2023-06-23 14:11:31 -06:00
Mark
0e583d620a implement new disjunction compilation 2023-06-23 14:11:31 -06:00
Mark Thom
3f445c76be add '$delete_all_attributes', use copy_term/3 as defined in #1272 2023-02-20 01:11:51 -07:00
Mark Thom
a6e416f13d compile '$atts' and '$project_atts' modules using loader.pl 2023-02-20 01:11:35 -07:00
Mark Thom
8781e03863 cache ball terms before unifying in handle_ball/3 (#1608) 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
91d4e91f53 prefix inlined goals with module names in expand_subgoal/5 (#1551) 2022-10-26 23:36:07 -06:00
Mark Thom
ad3ae7991b try to invoke '$call_inline' a second time in call/N (#1543) 2022-10-26 23:36:07 -06:00
Mark Thom
fce45167a5 fail when exception caught from subgoal expansion (#1535) 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
2eec6499ff propagate inference_limit_exceeded errors through the loader (#1298) 2022-06-18 11:26:31 -06:00
Mark Thom
cd1150c11d use setup_cal_n_init_goal_info in dynamic_module_resolution 2022-06-15 22:33:13 -06:00
Mark Thom
987bbdecf5 improve efficiency of call/N, replace '$call_with_default_policy' with
'$call_with_inference_counting'
2022-06-12 22:34:07 -06:00