From 52f06f5f60362c600d7bf4f888413de94ff0d809 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADtor=20Santos=20Costa?= Date: Fri, 23 Mar 2012 14:42:26 +0000 Subject: [PATCH 1/2] un: strict iso update --- pl/strict_iso.yap | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/pl/strict_iso.yap b/pl/strict_iso.yap index b2b99c278..fa00bd15f 100644 --- a/pl/strict_iso.yap +++ b/pl/strict_iso.yap @@ -96,6 +96,7 @@ '$do_error'(domain_error(builtin_procedure,G), G). '$iso_builtin'(abolish(_)). +'$iso_builtin'(acylic_term(_)). '$iso_builtin'(arg(_,_,_)). '$iso_builtin'(_=:=_). '$iso_builtin'(_=\=_). @@ -115,12 +116,21 @@ '$iso_builtin'(atomic(_)). '$iso_builtin'(bagof(_,_,_)). '$iso_builtin'(call(_)). +'$iso_builtin'(call(_,_)). +'$iso_builtin'(call(_,_,_)). +'$iso_builtin'(call(_,_,_,_)). +'$iso_builtin'(call(_,_,_,_,_)). +'$iso_builtin'(call(_,_,_,_,_,_)). +'$iso_builtin'(call(_,_,_,_,_,_,_)). +'$iso_builtin'(call(_,_,_,_,_,_,_,_)). +'$iso_builtin'(callable(_)). '$iso_builtin'(catch(_,_,_)). '$iso_builtin'(char_code(_,_)). '$iso_builtin'(char_conversion(_,_)). '$iso_builtin'(clause(_,_)). '$iso_builtin'(close(_)). '$iso_builtin'(close(_,_)). +'$iso_builtin'(compare(_,_,_)). '$iso_builtin'(compound(_)). '$iso_builtin'((_,_)). '$iso_builtin'(copy_term(_,_)). @@ -133,6 +143,7 @@ '$iso_builtin'(!). '$iso_builtin'((_;_)). '$iso_builtin'(fail). +'$iso_builtin'(false). '$iso_builtin'(findall(_,_,_)). '$iso_builtin'(float(_)). '$iso_builtin'(abort). @@ -145,11 +156,13 @@ '$iso_builtin'(get_char(_,_)). '$iso_builtin'(get_code(_)). '$iso_builtin'(get_code(_,_)). +'$iso_builtin'(ground(_)). '$iso_builtin'(halt). '$iso_builtin'(halt(_)). '$iso_builtin'((_->_)). '$iso_builtin'(integer(_)). '$iso_builtin'(_ is _). +'$iso_builtin'(keysort(_,_)). '$iso_builtin'(nl). '$iso_builtin'(nl(_)). '$iso_builtin'(nonvar(_)). @@ -179,19 +192,23 @@ '$iso_builtin'(read_term(_,_,_)). '$iso_builtin'(repeat). '$iso_builtin'(retract(_)). +'$iso_builtin'(retractall(_)). '$iso_builtin'(set_input(_)). '$iso_builtin'(set_output(_)). '$iso_builtin'(set_prolog_flag(_,_)). '$iso_builtin'(set_stream_position(_,_)). '$iso_builtin'(setof(_,_,_)). +'$iso_builtin'(sort(_,_)). '$iso_builtin'(stream_property(_,_)). '$iso_builtin'(sub_atom(_,_,_,_,_)). +'$iso_builtin'(subsumes_term(_,_)). '$iso_builtin'(_@>_). '$iso_builtin'(_@>=_). '$iso_builtin'(_==_). '$iso_builtin'(_@<_). '$iso_builtin'(_@=<_). '$iso_builtin'(_\==_). +'$iso_builtin'(term_variables(_,_)). '$iso_builtin'(throw(_)). '$iso_builtin'(true). '$iso_builtin'(_\=_). From 9c42dfa26caec69285c25df681d0d06ecb8e61ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADtor=20Santos=20Costa?= Date: Fri, 23 Mar 2012 15:00:58 +0000 Subject: [PATCH 2/2] UW Experimental: Superfast phrase/3. This version is simply using call/3 --- pl/grammar.yap | 40 ++++++++++++++++++++++++++++------------ pl/modules.yap | 6 ++++++ 2 files changed, 34 insertions(+), 12 deletions(-) diff --git a/pl/grammar.yap b/pl/grammar.yap index 4e2c90239..f532a6c02 100644 --- a/pl/grammar.yap +++ b/pl/grammar.yap @@ -132,19 +132,35 @@ phrase(PhraseDef, WordList) :- phrase(PhraseDef, WordList, []). +phrase(P, S0, S) :- + call(P, S0, S). +!(S, S). -phrase(P, S0, S) :- - var(P), !, - '$do_error'(instantiation_error,phrase(P,S0,S)). -phrase(P, S0, S) :- - ( primitive(P), \+ atom(P) ), !, - '$do_error'(type_error(callable,P),phrase(P,S0,S)). -phrase([], S0, S) :- !, - S0 = S. -phrase([H|T], S0, S) :- !, +[](S, S). + +'.'(H,T, S0, S) :- lists:append([H|T], S, S0). -phrase(Phrase, S0, S) :- - '$t_body'(Phrase, _, last, S0, S, Goal), !, - '$execute'(Goal). +{}(Goal, S0, S) :- + Goal, + S0 = S. +','(A,B, S0, S) :- + '$t_body'((A,B), _, last, S0, S, Goal), + '$execute'(Goal). + +;(A,B, S0, S) :- + '$t_body'((A;B), _, last, S0, S, Goal), + '$execute'(Goal). + +'|'(A,B, S0, S) :- + '$t_body'((A|B), _, last, S0, S, Goal), + '$execute'(Goal). + +->(A,B, S0, S) :- + '$t_body'((A->B), _, last, S0, S, Goal), + '$execute'(Goal). + +\+(A, S0, S) :- + '$t_body'(\+ A, _, last, S0, S, Goal), + '$execute'(Goal). diff --git a/pl/modules.yap b/pl/modules.yap index 8fd637f7c..2124f5e3e 100644 --- a/pl/modules.yap +++ b/pl/modules.yap @@ -647,6 +647,12 @@ source_module(Mod) :- (0 *-> 0), (0 ; 0), ^(+,0), + {}(0,?,?), + ','(2,2,?,?), + ;(2,2,?,?), + '|'(2,2,?,?), + ->(2,2,?,?), + \+(2,?,?), \+ 0 . %