implement DCGs using the logical expansion of the draft proposal

This commit is contained in:
Mark Thom
2019-10-05 00:17:57 -06:00
parent 3fa168d35b
commit 93d1cd1b09
4 changed files with 138 additions and 108 deletions

View File

@@ -24,8 +24,11 @@
'$read_query_term'(Term, VarList),
'$instruction_match'(Term, VarList).
% make '$compile_batch', a system routine, callable.
'$$compile_batch' :- '$compile_batch'.
'$instruction_match'([user], []) :-
!, '$compile_batch'.
!, catch('$$compile_batch', E, '$print_exception_with_check'(E)).
'$instruction_match'(Term, VarList) :-
'$submit_query_and_print_results'(Term, VarList),
!.
@@ -33,7 +36,14 @@
'$print_exception'(E) :-
write_term('caught: ', [quoted(false)]),
writeq(E),
nl.
nl.
'$print_exception_with_check'(E) :-
( E = error(_, _:_) -> true % if the error source contains a line
% number, a GNU-style error message
% is expected to be printed instead.
; '$print_exception'(E)
).
'$predicate_indicator'(Source, PI) :-
( nonvar(PI) ->