-
prolog_load_context(module, Module) :-
%% The source module (see ref-mod-mne). This is useful for example
%% if you are defining clauses for user:term_expansion/6 and need
%% to access the source module at compile time.
'$prolog_lc_module'(Module). 🤔 Does this mean rust compile time or is there a Prolog execution compilation phase? 🤔 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
This does not mean Rust compile time, since this is—and refers to—Prolog code and thus presumes a working Prolog engine. Scryer Prolog compiles Prolog code to Warren Abstract Machine (WAM) instructions, and in the future will compile such instructions to native code (#2424). When preparing Prolog text for execution, Scryer Prolog gives us a chance to automatically rewrite code in this phase, i.e., during compilation time (of Prolog code), by means of defining the predicates Line 258 in 2f47343 Quoting the Prolog ISO standard: 7.5.1 Preparing a Prolog text for execution Preparing a Prolog text for execution shall result in the complete database and processor being in an initial state of execution. The means by which a Prolog processor is asked to prepare standard-conforming Prolog texts (6.2) for execution shall be implementation defined. The manner in which a Prolog processor prepares standard-conforming Prolog texts for execution shall be implementation dependent. This process converts the read-terms in a Prolog text to the clauses of user-defined procedures in the database. All clauses of a procedure are ordered for execution according to the textual (or temporal) order of these clauses as they were prepared for execution. Any effects of reordering, adding or removing clauses by directives during preparation for execution are implemen- tation defined. The clauses of different procedures have no temporal or spatial correlation. The effect of directives while preparing a Prolog text for execution is defined in (7.4.2). |
Beta Was this translation helpful? Give feedback.
This does not mean Rust compile time, since this is—and refers to—Prolog code and thus presumes a working Prolog engine.
Scryer Prolog compiles Prolog code to Warren Abstract Machine (WAM) instructions, and in the future will compile such instructions to native code (#2424). When preparing Prolog text for execution, Scryer Prolog gives us a chance to automatically rewrite code in this phase, i.e., during compilation time (of Prolog code), by means of defining the predicates
goal_expansion/2
andterm_expansion/2
that relate Prolog terms that occur in the program to target terms that are compiled instead. See for instancelibrary(dcgs)
for usage examples of these facilities:scryer-prolo…