flora-commits Mailing List for Flora-2 (Page 115)
Brought to you by:
kifer
You can subscribe to this list here.
| 2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(59) |
Jun
(43) |
Jul
(4) |
Aug
(4) |
Sep
(102) |
Oct
(20) |
Nov
(47) |
Dec
(32) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2003 |
Jan
(24) |
Feb
(34) |
Mar
(72) |
Apr
(36) |
May
(10) |
Jun
(46) |
Jul
(36) |
Aug
(24) |
Sep
(37) |
Oct
(27) |
Nov
(43) |
Dec
(40) |
| 2004 |
Jan
(35) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(30) |
Aug
(83) |
Sep
(68) |
Oct
(38) |
Nov
(3) |
Dec
(7) |
| 2005 |
Jan
(9) |
Feb
(31) |
Mar
(46) |
Apr
(73) |
May
(21) |
Jun
(1) |
Jul
(32) |
Aug
(33) |
Sep
(3) |
Oct
(28) |
Nov
(4) |
Dec
(23) |
| 2006 |
Jan
(22) |
Feb
(2) |
Mar
(12) |
Apr
(23) |
May
(73) |
Jun
(14) |
Jul
|
Aug
(20) |
Sep
(14) |
Oct
(5) |
Nov
|
Dec
(14) |
| 2007 |
Jan
(54) |
Feb
(81) |
Mar
(286) |
Apr
(313) |
May
(154) |
Jun
(85) |
Jul
(8) |
Aug
(11) |
Sep
(12) |
Oct
(14) |
Nov
(6) |
Dec
(6) |
| 2008 |
Jan
|
Feb
|
Mar
(1) |
Apr
(12) |
May
(4) |
Jun
|
Jul
(13) |
Aug
(22) |
Sep
|
Oct
|
Nov
|
Dec
|
| 2013 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(46) |
Jun
(43) |
Jul
(46) |
Aug
(9) |
Sep
(13) |
Oct
(31) |
Nov
(42) |
Dec
(18) |
| 2014 |
Jan
(7) |
Feb
(7) |
Mar
(11) |
Apr
(13) |
May
(16) |
Jun
(6) |
Jul
(17) |
Aug
|
Sep
(2) |
Oct
|
Nov
(1) |
Dec
|
| 2015 |
Jan
|
Feb
(17) |
Mar
(4) |
Apr
(3) |
May
(2) |
Jun
(3) |
Jul
(2) |
Aug
(3) |
Sep
|
Oct
|
Nov
|
Dec
|
| 2016 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
(2) |
| 2017 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
| 2019 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <ki...@us...> - 2002-08-15 21:00:23
|
Update of /cvsroot/flora/flora2
In directory usw-pr-cvs1:/tmp/cvs-serv9432
Modified Files:
flroperator.P flrcomposer.P
Log Message:
backed out Guizhen's latest composer.
To get it back: use flrcomposer.P version 1.2
flroperator.P version 1.4
Index: flroperator.P
===================================================================
RCS file: /cvsroot/flora/flora2/flroperator.P,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- flroperator.P 30 Jun 2002 20:20:41 -0000 1.4
+++ flroperator.P 15 Aug 2002 21:00:20 -0000 1.5
@@ -127,9 +127,10 @@
flora_op(500,xfx,FL_AT).
-flora_op(400,fx,FL_PLIB).
-flora_op(400,fx,FL_PLIBALL).
-flora_op(400,fx,FL_FLORALIB).
+%% These operators are disabled until the composer is fixed
+%flora_op(400,fx,FL_PLIB).
+%flora_op(400,fx,FL_PLIBALL).
+%flora_op(400,fx,FL_FLORALIB).
flora_op(350,yfx,FL_ISA).
flora_op(350,yfx,FL_SUB).
Index: flrcomposer.P
===================================================================
RCS file: /cvsroot/flora/flora2/flrcomposer.P,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- flrcomposer.P 30 Jun 2002 20:20:41 -0000 1.2
+++ flrcomposer.P 15 Aug 2002 21:00:20 -0000 1.3
@@ -381,7 +381,7 @@
flora_compose(PrevToken,TmStack,OpStack,N,CurToken,Term,Status) :-
is_sole_operator(CurToken,Op),
!,
- compose_sole_operator(all,PrevToken,TmStack,OpStack,N,Op,Term,Status).
+ compose_sole_operator(PrevToken,TmStack,OpStack,N,Op,Term,Status).
flora_compose(PrevToken,TmStack,OpStack,N,CurToken,Term,Status) :-
is_sole_operand(CurToken),
@@ -408,19 +408,18 @@
/***************************************************************************
- compose_sole_operator(+Opt,+PrevToken,+TmStack,+OpStack,+N,+Op,-Term,-Status)
- is called when a symbol token is read. When Opt=all, try all operator
- definitions. If Opt=noprefix, skip try prefix definitions.
+ compose_sole_operator(+PrevToken,+TmStack,+OpStack,+N,+Op,-Term,-Status)
+ is called when a symbol token is read.
***************************************************************************/
-compose_sole_operator(_,PrevToken,TmStack,OpStack,N,Op,Term,Status) :-
+compose_sole_operator(PrevToken,TmStack,OpStack,N,Op,Term,Status) :-
is_infix(Op,L,R,P),
see_infix(PrevToken,TmStack,OpStack,N,Op,L,R,P,Term,Status).
-compose_sole_operator(all,PrevToken,TmStack,OpStack,N,Op,Term,Status) :-
+compose_sole_operator(PrevToken,TmStack,OpStack,N,Op,Term,Status) :-
is_prefix(Op,A,P),
see_prefix(PrevToken,TmStack,OpStack,N,Op,A,P,Term,Status).
-compose_sole_operator(_,PrevToken,TmStack,OpStack,N,Op,Term,Status) :-
+compose_sole_operator(PrevToken,TmStack,OpStack,N,Op,Term,Status) :-
is_suffix(Op,A,P),
see_suffix(PrevToken,TmStack,OpStack,N,Op,A,P,Term,Status).
@@ -441,21 +440,19 @@
see_operand(BRACE(B,I),TmStack,OpStack,N,CurToken,Term,Status).
compose_atom_operator(PrevToken,TmStack,OpStack,N,CurToken,Term,Status) :-
- PrevToken \= OPRND(_),
- see_operand(PrevToken,TmStack,OpStack,N,CurToken,Term,Status).
-
-compose_atom_operator(PrevToken,TmStack,OpStack,N,CurToken,Term,Status) :-
- %% Check if the next token is a left parenthesis.
- is_left_brace(X,_),
- M is N+1,
- (is_next_token(M,X) -> Opt=noprefix; Opt=all),
( CurToken=IDENTIFIER(I,_) ->
- OperatorAtom=I
+ compose_sole_operator(PrevToken,TmStack,OpStack,N,I,Term,Status)
+ ;
+ CurToken=QUOTED_ATOM(QA,_),
+ compose_sole_operator(PrevToken,TmStack,OpStack,N,QA,Term,Status)
+ ).
- ; CurToken=QUOTED_ATOM(QA,_) ->
- OperatorAtom=QA
- ),
- compose_sole_operator(Opt,PrevToken,TmStack,OpStack,N,OperatorAtom,Term,Status).
+compose_atom_operator(OPRND(_),_TmStack,_OpStack,_N,_CurToken,_Term,_Status) :-
+ !,
+ fail.
+
+compose_atom_operator(PrevToken,TmStack,OpStack,N,CurToken,Term,Status) :-
+ see_operand(PrevToken,TmStack,OpStack,N,CurToken,Term,Status).
/***************************************************************************
@@ -469,16 +466,15 @@
!,
see_operand(BRACE(B,I),TmStack,OpStack,N,CurToken,Term,Status).
+compose_symobject_operator(PrevToken,TmStack,OpStack,N,SYMBOL_TOKEN(S,_),Term,Status) :-
+ compose_sole_operator(PrevToken,TmStack,OpStack,N,S,Term,Status).
+
+compose_symobject_operator(OPRND(_),_TmStack,_OpStack,_N,_CurToken,_Term,_Status) :-
+ !,
+ fail.
+
compose_symobject_operator(PrevToken,TmStack,OpStack,N,CurToken,Term,Status) :-
- PrevToken \= OPRND(_),
see_operand(PrevToken,TmStack,OpStack,N,CurToken,Term,Status).
-
-compose_symobject_operator(PrevToken,TmStack,OpStack,N,SYMBOL_TOKEN(S,_),Term,Status) :-
- %% Check if the next token is a left parenthesis.
- is_left_brace(X,_),
- M is N+1,
- (is_next_token(M,X) -> Opt=noprefix; Opt=all),
- compose_sole_operator(Opt,PrevToken,TmStack,OpStack,N,S,Term,Status).
/***************************************************************************
|
|
From: <ch...@us...> - 2002-07-24 19:57:38
|
Update of /cvsroot/flora/flora2/genincludes In directory usw-pr-cvs1:/tmp/cvs-serv22809/genincludes Modified Files: flrpreddef.fli Log Message: fix a bug in undefinedness checking so that mvd(_,m,_) is defined when there are facts of the corresponding mvddef(_,m). Index: flrpreddef.fli =================================================================== RCS file: /cvsroot/flora/flora2/genincludes/flrpreddef.fli,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- flrpreddef.fli 18 May 2002 17:43:28 -0000 1.1.1.1 +++ flrpreddef.fli 24 Jul 2002 19:57:34 -0000 1.2 @@ -140,6 +140,8 @@ debugging, check_mvd(X,Y,Z), check_imvd(X,Y,Z), + check_mvddef(X,Y), + check_imvddef(X,Y), flora_error_undefined(mvd(X,Y,Z)), abort. @@ -149,6 +151,7 @@ d_imvd(X,Y,Z) :- debugging, check_imvd(X,Y,Z), + check_imvddef(X,Y), flora_error_undefined(imvd(X,Y,Z)), abort. |
|
From: <ki...@us...> - 2002-07-12 03:24:19
|
Update of /cvsroot/flora/flora2/docs
In directory usw-pr-cvs1:/tmp/cvs-serv17357/docs
Modified Files:
flora2.tex
Log Message:
more on parameter passing betw prolog and flora modules
Index: flora2.tex
===================================================================
RCS file: /cvsroot/flora/flora2/docs/flora2.tex,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- flora2.tex 2 Jul 2002 08:35:47 -0000 1.11
+++ flora2.tex 12 Jul 2002 03:24:16 -0000 1.12
@@ -304,6 +304,9 @@
with local scheduling, which is the default XSB configuration.
+\index{runflora script}
+\label{runflora-page}
+%%
The easiest way to get a feel of the system
is to start \FLORA shell and begin to enter queries interactively.
The simplest way to do this is to use the shell script
@@ -1873,6 +1876,18 @@
We will explain shortly which {\tt flImport} query should be used in what
situation.
+{\bf Note:} If you are using an interim release of \FLORA, which is
+installed outside of the XSB directory structure, then you must let Prolog
+know the location of your distribution of \FLORA. This is done by executing
+{\tt asserta(library\_directory(path-to-flora))} {\it e.g.},
+%%
+\begin{verbatim}
+ ?- asserta(library_directory('/home/me/flora2')).
+\end{verbatim}
+%%
+before calling any of the \FLORA modules. Observe that {\tt asserta} and
+\emph{not} {\tt assert} must be used.
+
\paragraph{Calling \FLORA from Prolog module.}
To call \FLORA from within a Prolog program, say {\tt test.P}, the
following must be done:
@@ -1943,6 +1958,37 @@
?- flLoadedModule({\it flora-module-name}).
\end{quote}
%%
+
+{\bf Note:} If you use an interim release of \FLORA that is installed
+outside of the XSB directory tree, you must make sure that Prolog will find
+this installation and use it in preference to the \FLORA package that is
+located in your XSB distribution. One way of doing this was described
+earlier (by executing an appropriate {\tt asserta/1}). This method works
+best if your application consists of both \FLORA and Prolog modules, but
+the initial module of your application ({\it i.e.}, the one that bootstraps
+everything) is a Prolog program. If the initial module is a \FLORA
+program, then the best way is to start XSB and \FLORA using the {\tt
+ runflora} script (page~\pageref{runflora-page}) located inside your
+interim distribution of \FLORA.
+
+\paragraph{Passing parameters between Prolog and \FLORA modules.}
+In an application that has both Prolog and \FLORA modules, parameter
+passing between modules plays an important role. We already discussed this
+issue in the context of calls from \FLORA to Prolog. The same applies to
+calls in the opposite direction. When calling a \FLORA module, it might be
+necessary to convert arguments represented as Prolog terms into HiLog and
+vice versa. For instance, if {\tt p/2} is a predicate imported from \FLORA,
+which uses the first argument as input and returns the result in the second
+argument, then one might need to use the following calling sequence:
+%%
+\begin{verbatim}
+ ... :- ..., flP2H(In,InHilog), p(InHilog,OutHilog), flP2H(Out,OutHilog), ...
+\end{verbatim}
+%%
+Here we assume that the Prolog module that calls the \FLORA predicate {\tt
+ p/1} passes the input through the variable {\tt In}and gets the result in
+the variable {\tt Out}.
+
\subsection{\FLORA System Modules}\label{sec-flora-system-modules}
|
|
From: <ki...@us...> - 2002-07-10 22:53:00
|
Update of /cvsroot/flora/flora-website In directory usw-pr-cvs1:/tmp/cvs-serv32431 Modified Files: release_notes.html florahome.php Log Message: links added minor other stuff Index: release_notes.html =================================================================== RCS file: /cvsroot/flora/flora-website/release_notes.html,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- release_notes.html 9 Jun 2002 00:10:20 -0000 1.8 +++ release_notes.html 10 Jul 2002 22:52:53 -0000 1.9 @@ -20,7 +20,10 @@ <h3>News</h3> <ul> - <li> </li> + <li>It is now possible to call X@Module, where X is a variable. This makes + it possible to construct a term and then call it in a module. For instance, + the following will work: p(X), X(a,Y), X@foo. + </li> <li> </li> </ul> <h3>Bugfixes</h3> Index: florahome.php =================================================================== RCS file: /cvsroot/flora/flora-website/florahome.php,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- florahome.php 8 Jun 2002 23:40:19 -0000 1.5 +++ florahome.php 10 Jul 2002 22:52:53 -0000 1.6 @@ -67,6 +67,11 @@ <li> <A href="http://www.cs.sunysb.edu/~kifer/dood/">The DOOD page</a>: additional links to information on Deductive and Object-Oriented Databases. +</li> +<li> <A href="http://www.cs.utexas.edu/users/mfkb/related.html"> + Knowledgebase/Ontology representation projects + </A> +</li> </ul> |
|
From: <ki...@us...> - 2002-07-02 08:35:50
|
Update of /cvsroot/flora/flora2/docs
In directory usw-pr-cvs1:/tmp/cvs-serv13109/docs
Modified Files:
flora2.tex
Log Message:
put back the mention of the syntax
@prolog mod
Index: flora2.tex
===================================================================
RCS file: /cvsroot/flora/flora2/docs/flora2.tex,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- flora2.tex 27 Jun 2002 07:12:54 -0000 1.10
+++ flora2.tex 2 Jul 2002 08:35:47 -0000 1.11
@@ -1717,15 +1717,13 @@
\index{module!{\tt prolog(modulename)}}
%%\index{module!{\tt prolog modulename}}
\paragraph{@prolog().}
-%%The syntax to call Prolog predicates is either one of the following:
-The syntax to call Prolog predicates is:
+The syntax to call Prolog predicates is either one of the following:
%%
\begin{quote}
\tt
- ?- {\it predicate}@prolog({\it module})
- %%\\
- %%\tt
- %%?- {\it predicate}@prolog {\it module}
+ ?- {\it predicate}@prolog({\it module}) \\
+ \tt
+ ?- {\it predicate}@prolog {\it module}
\end{quote}
%%
For instance, since the predicate {\tt member/2} is defined in the Prolog
@@ -1733,7 +1731,7 @@
%%
\begin{quote}
\tt
- ?- member(abc,[cde,abc,pqr])@prolog(basics).
+ ?- member(abc,[cde,abc,pqr])@prolog basics.
\end{quote}
%%
To use this mechanism, you must know which Prolog module the particular
@@ -1745,7 +1743,7 @@
%%
\begin{quote}
\tt
- ?- foo(X)@prolog(usermod).
+ ?- foo(X)@prolog usermod.
\end{quote}
%%
Note that variables are not allowed in the module specifications of Prolog
@@ -1774,7 +1772,7 @@
\index{module!{\tt prologall()}}
\index{module!{\tt prologall(modulename)}}
-%%\index{module!{\tt prologall modulename}}
+\index{module!{\tt prologall modulename}}
\paragraph{@prologall().}
The Prolog module specification {\tt @prolog()} has one subtlety: it does
not affect the arguments of a call. For instance,
@@ -1819,13 +1817,13 @@
ones. Thus,
%%
\begin{verbatim}
- ?- member(f(a), [f(b),f(a)])@prolog(basics).
+ ?- member(f(a), [f(b),f(a)])@prolog basics.
\end{verbatim}
%%
is perfectly acceptable and is more efficient than
%%
\begin{verbatim}
- ?- member(f(a), [f(b),f(a)])@prologall(basics).
+ ?- member(f(a), [f(b),f(a)])@prologall basics.
\end{verbatim}
%%
\index{flP2H/2}
|
|
From: <gz...@us...> - 2002-06-30 20:20:44
|
Update of /cvsroot/flora/flora2 In directory usw-pr-cvs1:/tmp/cvs-serv12839 Modified Files: flrcomposer.P flroperator.P Log Message: improved flrcomposer Index: flrcomposer.P =================================================================== RCS file: /cvsroot/flora/flora2/flrcomposer.P,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- flrcomposer.P 18 May 2002 17:43:26 -0000 1.1.1.1 +++ flrcomposer.P 30 Jun 2002 20:20:41 -0000 1.2 @@ -206,9 +206,6 @@ function_struct(F,A,FUNCTION(F,A)). -/************************************************************ - support for numbered anon oids -*************************************************************/ object_struct(O,I,OBJECT(T,I)) :- %% Strip textual information. ( O =.. [F,N,_], T =.. [F,N] @@ -361,6 +358,7 @@ ; PrevToken == NULL, TmStack == [], OpStack == [] -> Term=NULL, Status=[] + ; K is M-1, report_error(K,UNEXP_EOR), fail @@ -383,7 +381,7 @@ flora_compose(PrevToken,TmStack,OpStack,N,CurToken,Term,Status) :- is_sole_operator(CurToken,Op), !, - compose_sole_operator(PrevToken,TmStack,OpStack,N,Op,Term,Status). + compose_sole_operator(all,PrevToken,TmStack,OpStack,N,Op,Term,Status). flora_compose(PrevToken,TmStack,OpStack,N,CurToken,Term,Status) :- is_sole_operand(CurToken), @@ -410,18 +408,19 @@ /*************************************************************************** - compose_sole_operator(+PrevToken,+TmStack,+OpStack,+N,+Op,-Term,-Status) - is called when a symbol token is read. + compose_sole_operator(+Opt,+PrevToken,+TmStack,+OpStack,+N,+Op,-Term,-Status) + is called when a symbol token is read. When Opt=all, try all operator + definitions. If Opt=noprefix, skip try prefix definitions. ***************************************************************************/ -compose_sole_operator(PrevToken,TmStack,OpStack,N,Op,Term,Status) :- +compose_sole_operator(_,PrevToken,TmStack,OpStack,N,Op,Term,Status) :- is_infix(Op,L,R,P), see_infix(PrevToken,TmStack,OpStack,N,Op,L,R,P,Term,Status). -compose_sole_operator(PrevToken,TmStack,OpStack,N,Op,Term,Status) :- +compose_sole_operator(all,PrevToken,TmStack,OpStack,N,Op,Term,Status) :- is_prefix(Op,A,P), see_prefix(PrevToken,TmStack,OpStack,N,Op,A,P,Term,Status). -compose_sole_operator(PrevToken,TmStack,OpStack,N,Op,Term,Status) :- +compose_sole_operator(_,PrevToken,TmStack,OpStack,N,Op,Term,Status) :- is_suffix(Op,A,P), see_suffix(PrevToken,TmStack,OpStack,N,Op,A,P,Term,Status). @@ -434,6 +433,7 @@ parentheses. ***************************************************************************/ compose_atom_operator(BRACE(B,I),TmStack,OpStack,N,CurToken,Term,Status) :- + %% Check if the next token is a matching right parenthesis. is_right_brace(X,B), M is N+1, is_next_token(M,X), @@ -441,19 +441,21 @@ see_operand(BRACE(B,I),TmStack,OpStack,N,CurToken,Term,Status). compose_atom_operator(PrevToken,TmStack,OpStack,N,CurToken,Term,Status) :- - ( CurToken=IDENTIFIER(I,_) -> - compose_sole_operator(PrevToken,TmStack,OpStack,N,I,Term,Status) - ; - CurToken=QUOTED_ATOM(QA,_), - compose_sole_operator(PrevToken,TmStack,OpStack,N,QA,Term,Status) - ). - -compose_atom_operator(OPRND(_),_TmStack,_OpStack,_N,_CurToken,_Term,_Status) :- - !, - fail. + PrevToken \= OPRND(_), + see_operand(PrevToken,TmStack,OpStack,N,CurToken,Term,Status). compose_atom_operator(PrevToken,TmStack,OpStack,N,CurToken,Term,Status) :- - see_operand(PrevToken,TmStack,OpStack,N,CurToken,Term,Status). + %% Check if the next token is a left parenthesis. + is_left_brace(X,_), + M is N+1, + (is_next_token(M,X) -> Opt=noprefix; Opt=all), + ( CurToken=IDENTIFIER(I,_) -> + OperatorAtom=I + + ; CurToken=QUOTED_ATOM(QA,_) -> + OperatorAtom=QA + ), + compose_sole_operator(Opt,PrevToken,TmStack,OpStack,N,OperatorAtom,Term,Status). /*************************************************************************** @@ -467,16 +469,17 @@ !, see_operand(BRACE(B,I),TmStack,OpStack,N,CurToken,Term,Status). -compose_symobject_operator(PrevToken,TmStack,OpStack,N,SYMBOL_TOKEN(S,_),Term,Status) :- - compose_sole_operator(PrevToken,TmStack,OpStack,N,S,Term,Status). - -compose_symobject_operator(OPRND(_),_TmStack,_OpStack,_N,_CurToken,_Term,_Status) :- - !, - fail. - compose_symobject_operator(PrevToken,TmStack,OpStack,N,CurToken,Term,Status) :- + PrevToken \= OPRND(_), see_operand(PrevToken,TmStack,OpStack,N,CurToken,Term,Status). +compose_symobject_operator(PrevToken,TmStack,OpStack,N,SYMBOL_TOKEN(S,_),Term,Status) :- + %% Check if the next token is a left parenthesis. + is_left_brace(X,_), + M is N+1, + (is_next_token(M,X) -> Opt=noprefix; Opt=all), + compose_sole_operator(Opt,PrevToken,TmStack,OpStack,N,S,Term,Status). + /*************************************************************************** see_whitespace(+PrevToken,+TmStack,+OpStack,+N,-Term,-Status) @@ -995,7 +998,7 @@ /*************************************************************************** - solve_right(+TmStack,+OpStack,+N,-Term,-Status) + solve_end(+TmStack,+OpStack,+N,-Term,-Status) is called when a rule delimeter is just read. ***************************************************************************/ solve_end(TS,[INFOP(S,_L,_R,_P,I)|OS],N,Term,Status) :- Index: flroperator.P =================================================================== RCS file: /cvsroot/flora/flora2/flroperator.P,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- flroperator.P 26 Jun 2002 18:38:22 -0000 1.3 +++ flroperator.P 30 Jun 2002 20:20:41 -0000 1.4 @@ -127,9 +127,9 @@ flora_op(500,xfx,FL_AT). -%flora_op(400,fx,FL_PLIB). -%flora_op(400,fx,FL_PLIBALL). -%flora_op(400,fx,FL_FLORALIB). +flora_op(400,fx,FL_PLIB). +flora_op(400,fx,FL_PLIBALL). +flora_op(400,fx,FL_FLORALIB). flora_op(350,yfx,FL_ISA). flora_op(350,yfx,FL_SUB). @@ -138,7 +138,6 @@ flora_op(300,yfx,FL_MVD). flora_op(300,yfx,FL_INHERIFD). flora_op(300,yfx,FL_INHERIMVD). - /**************************************************************************** |
|
From: <ki...@us...> - 2002-06-27 07:12:58
|
Update of /cvsroot/flora/flora2/docs
In directory usw-pr-cvs1:/tmp/cvs-serv2340/docs
Modified Files:
flora2.tex
Log Message:
took out references to flora/prolog/prologall as operators
Index: flora2.tex
===================================================================
RCS file: /cvsroot/flora/flora2/docs/flora2.tex,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- flora2.tex 14 Jun 2002 09:05:32 -0000 1.9
+++ flora2.tex 27 Jun 2002 07:12:54 -0000 1.10
@@ -1713,17 +1713,19 @@
and do not need to be loaded explicitly because the association between Prolog
programs and modules is fixed.
-\index{module!{\tt prologall()}}
-\index{module!{\tt prologall(modulename)}}
-\index{module!{\tt prologall modulename}}
+\index{module!{\tt prolog()}}
+\index{module!{\tt prolog(modulename)}}
+%%\index{module!{\tt prolog modulename}}
\paragraph{@prolog().}
-The syntax to call Prolog predicates is either one of the following:
+%%The syntax to call Prolog predicates is either one of the following:
+The syntax to call Prolog predicates is:
%%
\begin{quote}
\tt
- ?- {\it predicate}@prolog({\it module}) \\
- \tt
- ?- {\it predicate}@prolog {\it module}
+ ?- {\it predicate}@prolog({\it module})
+ %%\\
+ %%\tt
+ %%?- {\it predicate}@prolog {\it module}
\end{quote}
%%
For instance, since the predicate {\tt member/2} is defined in the Prolog
@@ -1731,7 +1733,7 @@
%%
\begin{quote}
\tt
- ?- member(abc,[cde,abc,pqr])@prolog basics.
+ ?- member(abc,[cde,abc,pqr])@prolog(basics).
\end{quote}
%%
To use this mechanism, you must know which Prolog module the particular
@@ -1743,7 +1745,7 @@
%%
\begin{quote}
\tt
- ?- foo(X)@prolog usermod.
+ ?- foo(X)@prolog(usermod).
\end{quote}
%%
Note that variables are not allowed in the module specifications of Prolog
@@ -1772,7 +1774,7 @@
\index{module!{\tt prologall()}}
\index{module!{\tt prologall(modulename)}}
-\index{module!{\tt prologall modulename}}
+%%\index{module!{\tt prologall modulename}}
\paragraph{@prologall().}
The Prolog module specification {\tt @prolog()} has one subtlety: it does
not affect the arguments of a call. For instance,
@@ -1817,13 +1819,13 @@
ones. Thus,
%%
\begin{verbatim}
- ?- member(f(a), [f(b),f(a)])@prolog basics.
+ ?- member(f(a), [f(b),f(a)])@prolog(basics).
\end{verbatim}
%%
is perfectly acceptable and is more efficient than
%%
\begin{verbatim}
- ?- member(f(a), [f(b),f(a)])@prologall basics.
+ ?- member(f(a), [f(b),f(a)])@prologall(basics).
\end{verbatim}
%%
\index{flP2H/2}
|
|
From: <gz...@us...> - 2002-06-26 18:38:26
|
Update of /cvsroot/flora/flora2 In directory usw-pr-cvs1:/tmp/cvs-serv12901 Modified Files: flroperator.P Log Message: eliminate unncessary operator definitoins Index: flroperator.P =================================================================== RCS file: /cvsroot/flora/flora2/flroperator.P,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- flroperator.P 18 May 2002 20:19:16 -0000 1.2 +++ flroperator.P 26 Jun 2002 18:38:22 -0000 1.3 @@ -127,9 +127,9 @@ flora_op(500,xfx,FL_AT). -flora_op(400,fx,FL_PLIB). -flora_op(400,fx,FL_PLIBALL). -flora_op(400,fx,FL_FLORALIB). +%flora_op(400,fx,FL_PLIB). +%flora_op(400,fx,FL_PLIBALL). +%flora_op(400,fx,FL_FLORALIB). flora_op(350,yfx,FL_ISA). flora_op(350,yfx,FL_SUB). |
|
From: <ki...@us...> - 2002-06-19 06:47:19
|
Update of /cvsroot/flora/flora2/debugger
In directory usw-pr-cvs1:/tmp/cvs-serv21622/debugger
Modified Files:
static_data.in flrdebugger.P
Log Message:
squashed a bunch of bugs
Index: static_data.in
===================================================================
RCS file: /cvsroot/flora/flora2/debugger/static_data.in,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- static_data.in 18 May 2002 17:43:28 -0000 1.1.1.1
+++ static_data.in 19 Jun 2002 06:47:15 -0000 1.2
@@ -110,6 +110,9 @@
flora_show_this_hide(FLLIBDELETE/2).
flora_show_this_hide(FLLIBDELETE/1).
+%% A ~ B
+flora_show_this_hide(FLLIBUNIVEQFORM/2).
+
%% Dynamic module spec wrappers
flora_show_this_hide(FLLIBMODLIT/3).
flora_show_this_hide(FLLIBMODLIT/4).
Index: flrdebugger.P
===================================================================
RCS file: /cvsroot/flora/flora2/debugger/flrdebugger.P,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- flrdebugger.P 25 May 2002 21:53:31 -0000 1.2
+++ flrdebugger.P 19 Jun 2002 06:47:15 -0000 1.3
@@ -53,6 +53,7 @@
:- import flora_concat_atoms/2,
flora_slash/1,
+ flora_match_substring/5,
flora_set_counter/2
from flrporting.
@@ -104,7 +105,7 @@
?- assert((
flora_write_debugger_hook(X) :-
(\+flora_switch(low_level_trace) -> flora_write_goal(X)
- ; print_item(X)
+ ; flora_write_dbg_item(X)
)
)).
@@ -119,7 +120,7 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% flora_write_goal %%%%%%%%%%%%%%%%%%%%%%%%%%%
-flora_write_goal(Call) :- var(Call), print_item(Call).
+flora_write_goal(Call) :- var(Call), !, flora_write_dbg_item(Call).
flora_write_goal(Call) :-
classify_call(Call, Type,Basename,ArgList,Workspace),
@@ -130,14 +131,14 @@
; Type == (flogic)
-> flora_write_flogic(Basename,ArgList,Workspace)
; Type == (inheritance)
- -> print_item('(Trying to derive by inheritance) '),
+ -> flora_write_dbg_item('(Trying to derive by inheritance) '),
flora_write_flogic(Basename,ArgList,Workspace)
; Type == (definedvalue)
- -> print_item('derivable by deduction '),
+ -> flora_write_dbg_item('derivable by deduction '),
append(ArgList, ['...'], NewArgList),
flora_write_flogic(Basename,NewArgList,Workspace)
; Type == (conflictvalue)
- -> print_item('inheritance conflict for '),
+ -> flora_write_dbg_item('inheritance conflict for '),
append(ArgList, ['...'], NewArgList),
flora_write_flogic(Basename,NewArgList,Workspace)
),
@@ -174,12 +175,12 @@
%% flLoad in the form of [...]
flora_write_goal(Call) :-
Call = FLLIBLOAD(Arg),
- print_item('['),
+ flora_write_dbg_item('['),
(Arg = '>>'(File,Module)
-> print_items((File,'>>',Module))
- ; print_item(File)
+ ; flora_write_dbg_item(File)
),
- print_item(']').
+ flora_write_dbg_item(']').
%% List of goals -- the last one
flora_write_goal(Call) :-
@@ -196,7 +197,7 @@
write_disjunction(Call).
flora_write_goal('->'(Call1,Call2)) :-
flora_write_goal(Call1),
- print_item(' -> '),
+ flora_write_dbg_item(' -> '),
flora_write_goal(Call2).
flora_write_goal(Call) :-
@@ -205,28 +206,28 @@
!,
print_items((F,'(')),
flora_write_goal(Subcall),
- print_item(')').
+ flora_write_dbg_item(')').
flora_write_goal(Call) :-
- Call = FL_UNIVEQFORM(Left,Right),
+ Call = FLLIBUNIVEQFORM(Left,Right),
!,
flora_write_goal(Left),
print_items((' ', FL_UNIVEQFORM, ' ')),
flora_write_goal(Right).
flora_write_goal(call(Call)) :-
- print_item('call('),
+ flora_write_dbg_item('call('),
flora_write_goal(Call),
- print_item(')').
+ flora_write_dbg_item(')').
flora_write_goal(catch(Call,Catcher,Handler)) :-
- print_item('catch('),
+ flora_write_dbg_item('catch('),
flora_write_goal(Call),
- print_item(','),
+ flora_write_dbg_item(','),
write_hilog(Catcher),
- print_item(','),
+ flora_write_dbg_item(','),
flora_write_goal(Handler),
- print_item(')').
+ flora_write_dbg_item(')').
flora_write_goal(FLLIBIFTHENELSE(Cond,Then,Else)) :-
!,
@@ -260,12 +261,26 @@
%% This occurs when you have hilog-lit@Module, where Module is a var
flora_write_goal(FLLIBMODLIT(WRAP_HILOG,Args,Module)) :-
!,
+ (nonvar(Args), !
+ ; abort('[Debugger] Internal error: Invalid FLLIBMODLIT/3 goal')),
Args = [Basename|ArgList],
flora_write_hilog(Basename,ArgList,Module).
+
+%% This occurs when you have X@..., i.e., the literal part is a variable
+flora_write_goal(FLLIBMODLIT(FL_LIBMOD,Args,Module)) :-
+ !,
+ ((var(Args) ; atomic(Args)) ->
+ flora_write_dbg_item('~w@~w',[Args,Module])
+ ; flora_write_goal(Args),
+ flora_write_dbg_item('@~w',[Module])
+ ).
+
+
%% This occurs when you have flogic-lit@Module, where Module is a var
flora_write_goal(FLLIBMODLIT(Basename,Args,Module)) :-
!,
flora_write_flogic(Basename,Args,Module).
+
%% This occurs when you have firstorder-lit@Module, where Module is a var
flora_write_goal(FLLIBMODLIT(FL_FIRSTORDER,Basename,Args,Module)) :-
!,
@@ -277,36 +292,47 @@
flora_write_prolog(Call).
%% catch all
-flora_write_goal(Call) :- print_item(Call).
+flora_write_goal(Call) :- flora_write_dbg_item(Call).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-write_goal_commalist(','(G,Gs)) :-
+write_goal_commalist(G) :-
+ flora_write_dbg_item('('),
+ write_goal_commalist_internal(G).
+ flora_write_dbg_item(')').
+
+write_goal_commalist_internal(G) :-
+ var(G),
+ !,
+ flora_write_dbg_item(G).
+write_goal_commalist_internal(','(G,Gs)) :-
!,
flora_write_goal(G),
- print_item(','),
- write_goal_commalist(Gs).
-write_goal_commalist(G) :-
+ flora_write_dbg_item(','),
+ write_goal_commalist_internal(Gs).
+write_goal_commalist_internal(G) :-
!,
flora_write_goal(G).
-write_goal_list([]) :- !, print_item([]).
+write_goal_list([]) :- !, flora_write_dbg_item([]).
write_goal_list(List) :-
- print_item('['),
+ flora_write_dbg_item('['),
write_goal_list_internal(List),
- print_item(']').
+ flora_write_dbg_item(']').
write_goal_list_internal([H]) :-
!,
flora_write_goal(H).
write_goal_list_internal([H|R]) :-
!,
flora_write_goal(H),
- print_item(','),
+ flora_write_dbg_item(','),
write_goal_list_internal(R).
write_disjunction(';'(G1,G2)) :-
!,
+ flora_write_dbg_item('('),
flora_write_goal(G1),
- print_item(' ; '),
- flora_write_goal(G2).
+ flora_write_dbg_item(' ; '),
+ flora_write_goal(G2),
+ flora_write_dbg_item(')').
/*********************************************************************/
@@ -357,7 +383,7 @@
decode_molecule(Wrapper,Code,ComponentList) :-
- (str_match(FLDEBUGPREFIX,Wrapper,forward,0,End),! ; End=0),
+ (flora_match_substring(FLDEBUGPREFIX,Wrapper,forward,0,End),! ; End=0),
substring(Wrapper,End,_,BaseWrapper),
decode_molecule_base(BaseWrapper,Code,ComponentList).
@@ -407,83 +433,85 @@
flora_write_builtin(F,Arity,Args).
flora_write_prolog(Call) :-
Call =.. [F|Args],
- print_items((F,'(')),
- write_hilog_args(Args),
- print_item(')@prolog()').
+ (Args == [] -> print_items((Call,'@prolog()'))
+ ; print_items((F,'(')),
+ write_hilog_args(Args),
+ flora_write_dbg_item(')@prolog()')
+ ).
-flora_write_builtin(F,0,_) :- !, print_item(F).
+flora_write_builtin(F,0,_) :- !, flora_write_dbg_item(F).
%% This would have to be expanded to deal with unary ops
flora_write_builtin(F,1,[Arg]) :- !,
print_items((F,'(')),
write_hilog(Arg),
- print_item(')').
+ flora_write_dbg_item(')').
%% This deals with binary ops
flora_write_builtin(F,2,[Arg1,Arg2]) :- !,
((flora_opdef(_,xfx,F); flora_opdef(_,yfx,F); flora_opdef(_,xfy,F))
-> write_hilog(Arg1), print_items((' ',F,' ')), write_hilog(Arg2)
; print_items((F,'(')),
- write_hilog(Arg1), print_item(','), write_hilog(Arg2),
- print_item(')')
+ write_hilog(Arg1), flora_write_dbg_item(','), write_hilog(Arg2),
+ flora_write_dbg_item(')')
).
flora_write_builtin(F,_,Args) :-
print_items((F,'(')),
write_hilog_args(Args),
- print_item(')').
+ flora_write_dbg_item(')').
%%%%%%%%%%%%%%%%%%%%%% Firstorder %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
flora_write_firstorder(Basename,ArgList,Workspace) :-
print_items((Basename,'(')),
write_hilog_args(ArgList),
- print_item(')'),
+ flora_write_dbg_item(')'),
write_workspace(Workspace).
%%%%%%%%%%%%%%%%%%%%%% IF %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
flora_print_if_statement(Cond,Then) :-
- print_item('IF ('),
+ flora_write_dbg_item('IF ('),
flora_write_goal(Cond),
- print_item(') THEN ('),
+ flora_write_dbg_item(') THEN ('),
flora_write_goal(Then),
- print_item(')').
+ flora_write_dbg_item(')').
flora_print_if_statement(Cond,Then,Else) :-
- print_item('IF ('),
+ flora_write_dbg_item('IF ('),
flora_write_goal(Cond),
- print_item(') THEN ('),
+ flora_write_dbg_item(') THEN ('),
flora_write_goal(Then),
- print_item(') ELSE ('),
+ flora_write_dbg_item(') ELSE ('),
flora_write_goal(Else),
- print_item(')').
+ flora_write_dbg_item(')').
%%%%%%%%%%%%%%%%%%%%%% UNLESS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
flora_print_unless(Cond,Action) :-
- print_item('UNLESS ('),
+ flora_write_dbg_item('UNLESS ('),
flora_write_goal(Cond),
print_items((') ', 'DO', ' (')),
flora_write_goal(Action),
- print_item(')').
+ flora_write_dbg_item(')').
%%%%%%%%%%%%%%%%%%%%%% WHILE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
flora_print_while(LoopType,Cond,Action) :-
- print_item('WHILE ('),
+ flora_write_dbg_item('WHILE ('),
flora_write_goal(Cond),
print_items((') ', LoopType, ' (')),
flora_write_goal(Action),
- print_item(')').
+ flora_write_dbg_item(')').
%%%%%%%%%%%%%%%%%%%%%% UNTIL %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
flora_print_until(LoopType,Action,Cond) :-
print_items((LoopType, ' (')),
flora_write_goal(Action),
- print_item(') UNTIL ( '),
+ flora_write_dbg_item(') UNTIL ( '),
flora_write_goal(Cond),
- print_item(')').
+ flora_write_dbg_item(')').
%%%%%%%%%%%%%%%%%%%%% Updates %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -504,18 +532,18 @@
flora_write_update(UpdName,UpdLiterals) :-
print_items((UpdName,'{')),
write_update_literals(UpdLiterals),
- print_item('}').
+ flora_write_dbg_item('}').
flora_write_update(UpdName,UpdLiterals,Query) :-
print_items((UpdName,'{')),
write_update_literals(UpdLiterals),
- print_item(' | '),
+ flora_write_dbg_item(' | '),
flora_write_goal(Query),
- print_item('}').
+ flora_write_dbg_item('}').
write_update_literals([]).
write_update_literals([L|Rest]) :-
L = FLSYSDBUPDATE(Literal,_Storage),
flora_write_goal(Literal),
- (Rest \== [] -> print_item(','); true),
+ (Rest \== [] -> flora_write_dbg_item(','); true),
write_update_literals(Rest).
@@ -527,13 +555,13 @@
print_items((ComparisonVar,Comparison,AggrName,'{',
AggrVar,GroupVarList,' | ')),
flora_write_goal(Query),
- print_item('}').
+ flora_write_dbg_item('}').
*/
flora_write_aggregate(AggrName,AggrVar,GroupVarList,Query,AggrResult) :-
write_hilog(AggrResult),
print_items((' = ',AggrName,'{',AggrVar,GroupVarList,' | ')),
flora_write_goal(Query),
- print_item('}').
+ flora_write_dbg_item('}').
is_aggregate_call(FLLIBMIN,FL_MIN).
is_aggregate_call(FLLIBMAX,FL_MAX).
@@ -582,17 +610,17 @@
write_value(Val) :-
atomic(Val),
!,
- print_item(Val).
+ flora_write_dbg_item(Val).
write_value(Val) :-
is_charlist(Val),
!,
flora_write_dbg_item('"~w"', [Val]).
-write_value(Val) :- var(Val), !, print_item( Val).
-write_value(=(_N,Var)) :- !, print_item( Var).
+write_value(Val) :- var(Val), !, flora_write_dbg_item( Val).
+write_value(=(_N,Var)) :- !, flora_write_dbg_item( Var).
write_value(WRAP_FDSKOLEM(X,Y)) :- !,
- write_value(X), print_item('.'), write_value(Y).
+ write_value(X), flora_write_dbg_item('.'), write_value(Y).
write_value(WRAP_IFDSKOLEM(X,Y)) :- !,
- write_value(X), print_item('!'), write_value(Y).
+ write_value(X), flora_write_dbg_item('!'), write_value(Y).
write_value(Val) :-
is_flogic(Val),
!,
@@ -600,15 +628,19 @@
write_value(Val) :-
is_commalist(Val),
!,
- write_goal_commalist(Val).
+ flora_write_dbg_item('('),
+ write_hilog_args_commalist(Val),
+ flora_write_dbg_item(')').
write_value(Val) :-
is_list_term(Val),
!,
- write_goal_list(Val).
+ flora_write_dbg_item('['),
+ write_hilog_args(Val),
+ flora_write_dbg_item(']').
write_value(Val) :-
is_disjunction(Val),
!,
- write_disjunction(Val).
+ write_term_disjunction(Val).
write_value(Val) :-
is_hilog(Val),
!,
@@ -616,15 +648,15 @@
write_value(Val) :-
is_prolog(Val),
!,
- print_item(Val).
+ flora_write_dbg_item(Val).
write_hilog(Val) :-
(atomic(Val);var(Val)),
!,
(atom(Val), flora_decode_predicate(Val,_,WS,_,Basename,_),
nonvar(WS), nonvar(Basename)
- -> print_item(Basename) ,write_workspace(WS)
- ; print_item(Val)
+ -> flora_write_dbg_item(Basename) ,write_workspace(WS)
+ ; flora_write_dbg_item(Val)
).
write_hilog(FLLIBMODLIT(Wrap,Args,Module)) :- !,
@@ -633,17 +665,19 @@
write_hilog(Val) :-
is_commalist(Val),
!,
- write_goal_commalist(Val).
+ flora_write_dbg_item('('),
+ write_hilog_args_commalist(Val),
+ flora_write_dbg_item(')').
write_hilog(Val) :-
is_list_term(Val),
!,
- print_item('['),
+ flora_write_dbg_item('['),
write_hilog_args(Val),
- print_item(']').
+ flora_write_dbg_item(']').
write_hilog(Val) :-
is_disjunction(Val),
!,
- write_disjunction(Val).
+ write_term_disjunction(Val).
write_hilog(Val) :-
is_flogic(Val),
!,
@@ -658,9 +692,9 @@
-> write_hilog(Head),
(Args == [], !
;
- print_item( '('),
+ flora_write_dbg_item( '('),
write_hilog_args(Args),
- print_item( ')')
+ flora_write_dbg_item( ')')
),
(nonvar(WS) -> write_workspace(WS); true)
; % Not a hilog term
@@ -668,13 +702,32 @@
)
).
-write_hilog_args([]) :- true.
-write_hilog_args([Arg]) :- !, write_hilog(Arg).
+write_hilog_args([]) :- !.
write_hilog_args([Arg|Rest]) :-
!,
write_hilog(Arg),
- print_item(','),
- write_hilog_args(Rest).
+ (Rest == [], !
+ ; var(Rest) -> print_items(('|',Rest))
+ ; flora_write_dbg_item(','),
+ write_hilog_args(Rest)
+ ).
+
+write_hilog_args_commalist(T) :- var(T), !, flora_write_dbg_item(T).
+write_hilog_args_commalist(','(H,T)) :-
+ !,
+ write_hilog(H),
+ flora_write_dbg_item(','),
+ write_hilog_args_commalist(T).
+write_hilog_args_commalist(T) :-
+ !,
+ write_hilog(T).
+
+write_term_disjunction(';'(L,R)) :-
+ flora_write_dbg_item('('),
+ write_hilog(L),
+ flora_write_dbg_item(';'),
+ write_hilog(R),
+ flora_write_dbg_item(')').
write_workspace(WS) :-
@@ -694,18 +747,18 @@
!, flora_write_vars(V,Rest).
flora_write_vars(V,Rest) :-
- print_item(V),
+ flora_write_dbg_item(V),
(Rest == [] -> true
- ; print_item(','), flora_write_vars(Rest)
+ ; flora_write_dbg_item(','), flora_write_vars(Rest)
).
*/
-print_item(Item) :- flora_write_dbg_item(Item).
+print_items(X) :- var(X), !, flora_write_dbg_item(X).
print_items(','(Item,Rest)) :-
!,
- print_item(Item),
+ flora_write_dbg_item(Item),
print_items(Rest).
-print_items(Item) :- print_item(Item).
+print_items(Item) :- flora_write_dbg_item(Item).
/*********************************************************************/
|
|
From: <gz...@us...> - 2002-06-17 22:20:26
|
Update of /cvsroot/flora/flora2 In directory usw-pr-cvs1:/tmp/cvs-serv27237 Modified Files: flrparser.P Log Message: refine error message Index: flrparser.P =================================================================== RCS file: /cvsroot/flora/flora2/flrparser.P,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- flrparser.P 14 Jun 2002 09:05:32 -0000 1.5 +++ flrparser.P 17 Jun 2002 22:20:21 -0000 1.6 @@ -2331,6 +2331,10 @@ flobject_struct(ObjectTerm,Code), !. +flora_pathexp(CANOBRACE(_L,_N,I),_Code,Status) :- + !, + parsing_error(I,ERROR_SETNOTE,Status). + flora_pathexp(CanoniTerm,_Code,Status) :- parsing_error(CanoniTerm,ERROR_PATHEXP,Status). @@ -2708,6 +2712,10 @@ flora_head_pathexp(CANOTERM(_Funct,_N,FL_BRACE,_Args,_If,Ip),_Code,Status) :- !, parsing_error(Ip,NO_AGGINHEAD,Status). + +flora_head_pathexp(CANOBRACE(_L,_N,I),_Code,Status) :- + !, + parsing_error(I,ERROR_SETNOTE,Status). flora_head_pathexp(CanoniTerm,_Code,Status) :- parsing_error(CanoniTerm,ERROR_EXPINHEAD,Status). |
|
From: <gz...@us...> - 2002-06-17 22:20:26
|
Update of /cvsroot/flora/flora2/flrincludes In directory usw-pr-cvs1:/tmp/cvs-serv27237/flrincludes Modified Files: flora_errors.flh Log Message: refine error message Index: flora_errors.flh =================================================================== RCS file: /cvsroot/flora/flora2/flrincludes/flora_errors.flh,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- flora_errors.flh 14 Jun 2002 09:05:32 -0000 1.2 +++ flora_errors.flh 17 Jun 2002 22:20:22 -0000 1.3 @@ -109,6 +109,7 @@ #define ERROR_ARITY 'invalid arity (non-negative integers or variables expected)' #define ERROR_EQLSPEC 'invalid equality specification' #define ERROR_UPDATEOP 'invalid use of update operator where an oid is expected' +#define ERROR_SETNOTE 'invalid use of set notation' #define ERROR_GPP 'error while parsing the output from the gpp preprocessor' #define EXP_POSINTEGER 'positive integer (including 0) expected' #define EXP_VARIABLE 'variable expected' |
|
From: <ki...@us...> - 2002-06-17 07:00:57
|
Update of /cvsroot/flora/flora2/debugger
In directory usw-pr-cvs1:/tmp/cvs-serv11513/debugger
Modified Files:
NMakefile.mak Makefile
Log Message:
Better pretty printer for prolog
Some makefile work
Index: NMakefile.mak
===================================================================
RCS file: /cvsroot/flora/flora2/debugger/NMakefile.mak,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- NMakefile.mak 27 May 2002 07:59:22 -0000 1.2
+++ NMakefile.mak 17 Jun 2002 07:00:11 -0000 1.3
@@ -3,12 +3,13 @@
!include ..\.prolog_path
OBJEXT = .O
+PROLOGEXT = .P
ALLOBJS= flrdebugger$(OBJEXT) dynamic_data.dat static_data.dat
OPTIONS=[optimize]
-.SUFFIXES: .in .dat .P .H $(OBJEXT)
+.SUFFIXES: .in .dat $(PROLOGEXT) .H $(OBJEXT)
ALL:: $(ALLOBJS)
@@ -19,7 +20,7 @@
-@erase *.dat
-@erase *.bak
-.P$(OBJEXT):
+$(PROLOGEXT)$(OBJEXT):
$(PROLOG) -e "['..\flora2devel']. import bootstrap_flora/0 from flora2. bootstrap_flora,mc(%|fF,$(OPTIONS)). halt."
static_data.dat: static_data.in
Index: Makefile
===================================================================
RCS file: /cvsroot/flora/flora2/debugger/Makefile,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- Makefile 18 May 2002 17:43:29 -0000 1.1.1.1
+++ Makefile 17 Jun 2002 07:00:23 -0000 1.2
@@ -26,6 +26,7 @@
##
OBJEXT=.xwam
+PROLOGEXT=.P
FLORADIR = ..
@@ -38,7 +39,7 @@
FLORA_ERRORS = $(FLORA_INCLUDES_DIR)/flora_errors.flh
FLRHEADER = $(DYN_INCLUDES_DIR)/flrheader.flh
-.SUFFIXES: .in .dat .P .H ${OBJEXT}
+.SUFFIXES: .in .dat ${PROLOGEXT} .H ${OBJEXT}
OPTION = [optimize]
@@ -67,7 +68,7 @@
@echo 'flWrapAround($*).' >> cmd...
-flrdebugger${OBJEXT}: flrdebugger.P $(FLORA_TERMS)
+flrdebugger${OBJEXT}: flrdebugger${PROLOGEXT} $(FLORA_TERMS)
@echo 'mc(flrdebugger,$(OPTION)).' >> cmd...
|
|
From: <ki...@us...> - 2002-06-17 07:00:44
|
Update of /cvsroot/flora/flora2/demos
In directory usw-pr-cvs1:/tmp/cvs-serv11513/demos
Modified Files:
NMakefile.mak Makefile
Log Message:
Better pretty printer for prolog
Some makefile work
Index: NMakefile.mak
===================================================================
RCS file: /cvsroot/flora/flora2/demos/NMakefile.mak,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- NMakefile.mak 27 May 2002 07:59:22 -0000 1.2
+++ NMakefile.mak 17 Jun 2002 07:00:04 -0000 1.3
@@ -3,27 +3,32 @@
!include ..\.prolog_path
OBJEXT = .xwam
+PROLOGEXT = .P
-ALLOBJS = aggregate.P benchmark.P default.P family_obj.P \
- family_rel.P flogic_basics.P metavar.P mix.P module1.P mod1.P \
- mono_inherit.P rel_ops.P tree_traversal.P
+ALLOBJS = aggregate$(PROLOGEXT) benchmark$(PROLOGEXT) \
+ default$(PROLOGEXT) family_obj$(PROLOGEXT) \
+ family_rel$(PROLOGEXT) flogic_basics$(PROLOGEXT) \
+ metavar$(PROLOGEXT) mix$(PROLOGEXT) module1$(PROLOGEXT) \
+ mod1$(PROLOGEXT) \
+ mono_inherit$(PROLOGEXT) rel_ops$(PROLOGEXT) \
+ tree_traversal$(PROLOGEXT)
OPTIONS = [optimize]
-.SUFFIXES: .P .flr
+.SUFFIXES: $(PROLOGEXT) .flr
ALL: $(ALLOBJS)
-.flr.P:
+.flr$(PROLOGEXT):
$(PROLOG) -e "['..\flora2devel']. import bootstrap_flora/0 from flora2. bootstrap_flora. import (flCompile)/1 from flora2. flCompile(%|fF). halt."
CLEAN:
-@erase *~
-@erase *$(OBJEXT)
- -@erase *.P
- -@erase *.P_gpp
+ -@erase *$(PROLOGEXT)
+ -@erase *$(PROLOGEXT)_gpp
-@erase *.fdb
-@erase *.fld
-@erase *.bak
Index: Makefile
===================================================================
RCS file: /cvsroot/flora/flora2/demos/Makefile,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- Makefile 3 Jun 2002 04:28:25 -0000 1.2
+++ Makefile 17 Jun 2002 07:00:05 -0000 1.3
@@ -24,13 +24,18 @@
##
OBJEXT=.xwam
+PROLOGEXT=.P
FLORADIR = ..
-ALL = aggregate.P benchmark.P clpdemo.P default.P family_obj.P \
- family_rel.P flogic_basics.P metavar.P mix.P module1.P mod1.P \
- mono_inherit.P rel_ops.P tree_traversal.P \
- btupdates.P pretty.P
+ALL = aggregate${PROLOGEXT} benchmark${PROLOGEXT} \
+ clpdemo${PROLOGEXT} default${PROLOGEXT} family_obj${PROLOGEXT} \
+ family_rel${PROLOGEXT} flogic_basics${PROLOGEXT}\
+ metavar${PROLOGEXT} mix${PROLOGEXT} module1${PROLOGEXT}\
+ mod1${PROLOGEXT} clpdemo${PROLOGEXT} \
+ mono_inherit${PROLOGEXT} rel_ops${PROLOGEXT}\
+ tree_traversal${PROLOGEXT} \
+ btupdates${PROLOGEXT} pretty${PROLOGEXT}
Option = [optimize]
@@ -52,7 +57,7 @@
# suffix rules
-.SUFFIXES: .P .flr
+.SUFFIXES: ${PROLOGEXT} .flr
all: init recompile
@@ -60,7 +65,7 @@
./CompileChangedFiles.sh $(PROLOG_COMMAND)
@cat $(SVFILE)
-.flr.P:
+.flr${PROLOGEXT}:
echo 'import (flCompile)/1 from flora2. flCompile($*).' >> cmd...
init:
@@ -83,4 +88,4 @@
echo Done
clean:
- /bin/rm -f *.P *.P_gpp *${OBJEXT} *.O *.bak *.fdb *.fld *~ .*~ .#*
+ /bin/rm -f *${PROLOGEXT} *${PROLOGEXT}_gpp *${OBJEXT} *.O *.bak *.fdb *.fld *~ .*~ .#*
|
|
From: <ki...@us...> - 2002-06-17 07:00:44
|
Update of /cvsroot/flora/flora2/syslib
In directory usw-pr-cvs1:/tmp/cvs-serv11513/syslib
Modified Files:
NMakefile.mak Makefile
Log Message:
Better pretty printer for prolog
Some makefile work
Index: NMakefile.mak
===================================================================
RCS file: /cvsroot/flora/flora2/syslib/NMakefile.mak,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- NMakefile.mak 27 May 2002 07:59:21 -0000 1.2
+++ NMakefile.mak 17 Jun 2002 07:00:03 -0000 1.3
@@ -3,6 +3,7 @@
!include ..\.prolog_path
OBJEXT = .xwam
+PROLOGEXT = .P
ALLOBJS = flranswer$(OBJEXT) \
flrcontrol$(OBJEXT) \
@@ -26,7 +27,7 @@
OPTIONS = [optimize]
-.SUFFIXES: .P $(OBJEXT)
+.SUFFIXES: $(PROLOGEXT) $(OBJEXT)
ALL:: $(ALLOBJS)
@@ -37,7 +38,7 @@
-@erase .#*
-.P$(OBJEXT):
+$(PROLOGEXT)$(OBJEXT):
$(PROLOG) -e "['..\flora2devel']. import bootstrap_flora/0 from flora2. bootstrap_flora,mc(%|fF,$(OPTIONS)). halt."
Index: Makefile
===================================================================
RCS file: /cvsroot/flora/flora2/syslib/Makefile,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- Makefile 18 May 2002 17:43:28 -0000 1.1.1.1
+++ Makefile 17 Jun 2002 07:00:03 -0000 1.2
@@ -27,6 +27,7 @@
OBJEXT=.xwam
+PROLOGEXT = .P
PROLOG = none
FLORADIR = ..
@@ -75,77 +76,77 @@
@cat $(SVFILE)
-flranswer${OBJEXT} : flranswer.P $(FLORA_TERMS)
+flranswer${OBJEXT} : flranswer$(PROLOGEXT) $(FLORA_TERMS)
@echo 'mc(flranswer,$(OPTION)).' >> cmd...
-flrcontrol${OBJEXT} : flrcontrol.P $(FLORA_TERMS) $(XSB_STANDARD)
+flrcontrol${OBJEXT} : flrcontrol$(PROLOGEXT) $(FLORA_TERMS) $(XSB_STANDARD)
@echo 'mc(flrcontrol,$(OPTION)).' >> cmd...
-flrdisplay${OBJEXT} : flrdisplay.P $(FLORA_TERMS) $(XSB_STANDARD)
+flrdisplay${OBJEXT} : flrdisplay$(PROLOGEXT) $(FLORA_TERMS) $(XSB_STANDARD)
@echo 'mc(flrdisplay,$(OPTION)).' >> cmd...
-flrload${OBJEXT} : flrload.P $(FLORA_TERMS)
+flrload${OBJEXT} : flrload$(PROLOGEXT) $(FLORA_TERMS)
@echo 'mc(flrload,$(OPTION)).' >> cmd...
-flraggavg${OBJEXT} :flraggavg.P $(FLORA_TERMS)
+flraggavg${OBJEXT} :flraggavg$(PROLOGEXT) $(FLORA_TERMS)
@echo 'mc(flraggavg,$(OPTION)).' >> cmd...
-flraggcolbag${OBJEXT} : flraggcolbag.P $(FLORA_TERMS)
+flraggcolbag${OBJEXT} : flraggcolbag$(PROLOGEXT) $(FLORA_TERMS)
@echo 'mc(flraggcolbag,$(OPTION)).' >> cmd...
-flraggcolset${OBJEXT} : flraggcolset.P $(FLORA_TERMS)
+flraggcolset${OBJEXT} : flraggcolset$(PROLOGEXT) $(FLORA_TERMS)
@echo 'mc(flraggcolset,$(OPTION)).' >> cmd...
-flraggcount${OBJEXT} : flraggcount.P $(FLORA_TERMS)
+flraggcount${OBJEXT} : flraggcount$(PROLOGEXT) $(FLORA_TERMS)
@echo 'mc(flraggcount,$(OPTION)).' >> cmd...
-flraggmax${OBJEXT} : flraggmax.P $(FLORA_TERMS)
+flraggmax${OBJEXT} : flraggmax$(PROLOGEXT) $(FLORA_TERMS)
@echo 'mc(flraggmax,$(OPTION)).' >> cmd...
-flraggmin${OBJEXT} : flraggmin.P $(FLORA_TERMS)
+flraggmin${OBJEXT} : flraggmin$(PROLOGEXT) $(FLORA_TERMS)
@echo 'mc(flraggmin,$(OPTION)).' >> cmd...
-flraggsum${OBJEXT} : flraggsum.P $(FLORA_TERMS)
+flraggsum${OBJEXT} : flraggsum$(PROLOGEXT) $(FLORA_TERMS)
@echo 'mc(flraggsum,$(OPTION)).' >> cmd...
-flrstorage${OBJEXT} : flrstorage.P $(FLORA_TERMS)
+flrstorage${OBJEXT} : flrstorage$(PROLOGEXT) $(FLORA_TERMS)
@echo 'mc(flrstorage,$(OPTION)).' >> cmd...
-flrdbop${OBJEXT} : flrdbop.P $(FLORA_TERMS)
+flrdbop${OBJEXT} : flrdbop$(PROLOGEXT) $(FLORA_TERMS)
@echo 'mc(flrdbop,$(OPTION)).' >> cmd...
-flrbtdbop${OBJEXT} : flrbtdbop.P $(FLORA_TERMS)
+flrbtdbop${OBJEXT} : flrbtdbop$(PROLOGEXT) $(FLORA_TERMS)
@echo 'mc(flrbtdbop,$(OPTION)).' >> cmd...
-flrshdirect${OBJEXT} : flrshdirect.P $(FLORA_TERMS)
+flrshdirect${OBJEXT} : flrshdirect$(PROLOGEXT) $(FLORA_TERMS)
@echo 'mc(flrshdirect,$(OPTION)).' >> cmd...
-flrdynmod${OBJEXT} : flrdynmod.P $(FLORA_TERMS)
+flrdynmod${OBJEXT} : flrdynmod$(PROLOGEXT) $(FLORA_TERMS)
@echo 'mc(flrdynmod,$(OPTION)).' >> cmd...
-flrequality${OBJEXT} : flrequality.P $(FLORA_TERMS)
+flrequality${OBJEXT} : flrequality$(PROLOGEXT) $(FLORA_TERMS)
@echo 'mc(flrequality,$(OPTION)).' >> cmd...
-flrimport${OBJEXT}: flrimport.P $(FLORA_TERMS) $(FLRHEADER)
+flrimport${OBJEXT}: flrimport$(PROLOGEXT) $(FLORA_TERMS) $(FLRHEADER)
@echo 'mc(flrimport,$(OPTION)).' >> cmd...
-flrexpunge${OBJEXT} : flrexpunge.P $(FLORA_TERMS)
+flrexpunge${OBJEXT} : flrexpunge$(PROLOGEXT) $(FLORA_TERMS)
@echo 'mc(flrexpunge,$(OPTION)).' >> cmd...
|
|
From: <ki...@us...> - 2002-06-17 07:00:44
|
Update of /cvsroot/flora/flora2/trailer
In directory usw-pr-cvs1:/tmp/cvs-serv11513/trailer
Modified Files:
NMakefile.mak Makefile
Log Message:
Better pretty printer for prolog
Some makefile work
Index: NMakefile.mak
===================================================================
RCS file: /cvsroot/flora/flora2/trailer/NMakefile.mak,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- NMakefile.mak 27 May 2002 07:59:21 -0000 1.2
+++ NMakefile.mak 17 Jun 2002 07:00:02 -0000 1.3
@@ -3,10 +3,11 @@
!include ..\.prolog_path
OBJEXT = .O
+PROLOGEXT = .P
OPTIONS = [optimize]
-.SUFFIXES: .P .O
+.SUFFIXES: $(PROLOGEXT) .O
ALL::
$(PROLOG) -e "['..\flora2devel']. import bootstrap_flora/0 from flora2. bootstrap_flora. [flrutils]. import flsetuptrailer/1, flsetuppatch/0 from flrutils. flsetuptrailer(none). flsetuptrailer(basic). flsetuptrailer(flogic). flsetuppatch. halt."
@@ -14,7 +15,7 @@
CLEAN :
-@erase *~
-@erase *$(OBJEXT)
- -@erase *.P
+ -@erase *$(PROLOGEXT)
-@erase *.flh
-@erase *.bak
-@erase .#*
Index: Makefile
===================================================================
RCS file: /cvsroot/flora/flora2/trailer/Makefile,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- Makefile 18 May 2002 17:43:28 -0000 1.1.1.1
+++ Makefile 17 Jun 2002 07:00:03 -0000 1.2
@@ -28,6 +28,7 @@
OBJEXT=.xwam
+PROLOGEXT = .P
FLORADIR = ..
@@ -37,10 +38,10 @@
GENINCLUDES = ../genincludes
-ALLOBJS = standard.P \
- eqlbasic.P \
- eqlflogic.P \
- patch.P
+ALLOBJS = standard$(PROLOGEXT) \
+ eqlbasic$(PROLOGEXT) \
+ eqlflogic$(PROLOGEXT) \
+ patch$(PROLOGEXT)
PROLOG = none
@@ -64,26 +65,26 @@
@cat $(SVFILE)
-standard.P : $(CLOSURE)/flrcommon.flh \
+standard$(PROLOGEXT) : $(CLOSURE)/flrcommon.flh \
$(CLOSURE)/flrtrailer.flh $(HEADERINC)/flrheader_inc.flh \
$(HEADERINC)/flrtrailer_inc.flh
@echo 'flsetuptrailer(none).' >> cmd...
-eqlbasic.P : $(CLOSURE)/flrcommon.flh \
+eqlbasic$(PROLOGEXT) : $(CLOSURE)/flrcommon.flh \
$(CLOSURE)/flreqltrailer.flh $(HEADERINC)/flrheader_inc.flh \
$(HEADERINC)/flreqltrailer_inc.flh
@echo 'flsetuptrailer(basic).' >> cmd...
-eqlflogic.P : $(CLOSURE)/flrcommon.flh \
+eqlflogic$(PROLOGEXT) : $(CLOSURE)/flrcommon.flh \
$(CLOSURE)/flreqltrailer.flh $(CLOSURE)/flrscalareql.flh \
$(HEADERINC)/flrheader_inc.flh \
$(HEADERINC)/flreqltrailer_inc.flh $(HEADERINC)/flrscalareql_inc.flh
@echo 'flsetuptrailer(flogic).' >> cmd...
-patch.P : $(GENINCLUDES)/flrpatch.flh $(GENINCLUDES)/flrpreddef.flh \
+patch$(PROLOGEXT) : $(GENINCLUDES)/flrpatch.flh $(GENINCLUDES)/flrpreddef.flh \
$(HEADERINC)/flrheader_inc.flh \
$(HEADERINC)/flrdefinition_inc.flh \
$(HEADERINC)/flrpreddef_inc.flh
@@ -134,7 +135,7 @@
clean:
- /bin/rm -f *~ .*~ *.P *$(OBJEXT) *.O *.flh *.bak .#*
+ /bin/rm -f *~ .*~ *$(PROLOGEXT) *$(OBJEXT) *.O *.flh *.bak .#*
.DONE:
|
|
From: <ki...@us...> - 2002-06-17 07:00:44
|
Update of /cvsroot/flora/flora2/pkgs
In directory usw-pr-cvs1:/tmp/cvs-serv11513/pkgs
Modified Files:
NMakefile.mak Makefile
Log Message:
Better pretty printer for prolog
Some makefile work
Index: NMakefile.mak
===================================================================
RCS file: /cvsroot/flora/flora2/pkgs/NMakefile.mak,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- NMakefile.mak 27 May 2002 07:59:22 -0000 1.2
+++ NMakefile.mak 17 Jun 2002 07:00:03 -0000 1.3
@@ -3,24 +3,25 @@
!include ..\.prolog_path
OBJEXT = .xwam
+PROLOGEXT = .P
ALLOBJS =
OPTIONS=[optimize]
-.SUFFIXES: .P .flr
+.SUFFIXES: $(PROLOGEXT) .flr
ALL: $(ALLOBJS)
-.flr.P:
+.flr$(PROLOGEXT):
$(PROLOG) -e "['..\flora2devel']. import bootstrap_flora/0 from flora2. bootstrap_flora. import (flCompile)/1 from flora2. flCompile(%|fF)."
CLEAN:
-@erase *~
-@erase *$(OBJEXT)
- -@erase *.P
+ -@erase *$(PROLOGEXT)
-@erase *.fdb
-@erase *.fld
-@erase *.bak
Index: Makefile
===================================================================
RCS file: /cvsroot/flora/flora2/pkgs/Makefile,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- Makefile 18 May 2002 17:43:28 -0000 1.1.1.1
+++ Makefile 17 Jun 2002 07:00:04 -0000 1.2
@@ -25,6 +25,7 @@
OBJEXT=.xwam
+PROLOGEXT=.P
FLORADIR=..
@@ -49,7 +50,7 @@
# suffix rules
-.SUFFIXES: .P .flr
+.SUFFIXES: $(PROLOGEXT) .flr
# We should have touch *.flr here when there will be packages
all: clean init recompile
@@ -60,7 +61,7 @@
@rm cmd...
@cat $(SVFILE)
-.flr.P:
+.flr$(PROLOGEXT):
echo 'import (flCompile)/1 from flora2. flCompile($*).' >> cmd...
init:
@@ -82,4 +83,4 @@
echo Done
clean:
- /bin/rm -f core *.P *${OBJEXT} *.O *.fdb *.fld *.bak *~ .*~ .#*
+ /bin/rm -f core *$(PROLOGEXT) *${OBJEXT} *.O *.fdb *.fld *.bak *~ .*~ .#*
|
|
From: <ki...@us...> - 2002-06-17 07:00:43
|
Update of /cvsroot/flora/flora2/lib
In directory usw-pr-cvs1:/tmp/cvs-serv11513/lib
Modified Files:
NMakefile.mak Makefile
Log Message:
Better pretty printer for prolog
Some makefile work
Index: NMakefile.mak
===================================================================
RCS file: /cvsroot/flora/flora2/lib/NMakefile.mak,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- NMakefile.mak 27 May 2002 07:59:22 -0000 1.2
+++ NMakefile.mak 17 Jun 2002 07:00:04 -0000 1.3
@@ -1,26 +1,28 @@
# Make file for Microsoft NMAKE
OBJEXT = .xwam
+PROLOGEXT = .P
-ALLOBJS = flrprettyprint.P flrio.P flrstorage.P flrsystem.P
+ALLOBJS = flrprettyprint$(PROLOGEXT) flrio$(PROLOGEXT) \
+ flrstorage$(PROLOGEXT) flrsystem$(PROLOGEXT)
!include ..\.prolog_path
OPTIONS = [optimize]
-.SUFFIXES: .P .flr
+.SUFFIXES: $(PROLOGEXT) .flr
ALL: $(ALLOBJS)
-.flr.P:
+.flr$(PROLOGEXT):
$(PROLOG) -e "['..\flora2devel']. import bootstrap_flora/0 from flora2. bootstrap_flora. import flora_compile_system_module/1 from flrutils. flora_compile_system_module(%|fF). halt."
CLEAN:
-@erase *~
-@erase *$(OBJEXT)
- -@erase *.P
+ -@erase *$(PROLOGEXT)
-@erase *.fdb
-@erase *.fld
-@erase *.bak
Index: Makefile
===================================================================
RCS file: /cvsroot/flora/flora2/lib/Makefile,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- Makefile 18 May 2002 17:43:28 -0000 1.1.1.1
+++ Makefile 17 Jun 2002 07:00:04 -0000 1.2
@@ -23,10 +23,12 @@
##
OBJEXT=.xwam
+PROLOGEXT=.P
FLORADIR=..
-ALL = flrprettyprint.P flrio.P flrstorage.P flrsystem.P
+ALL = flrprettyprint${PROLOGEXT} flrio${PROLOGEXT} \
+ flrstorage${PROLOGEXT} flrsystem${PROLOGEXT}
Option = [optimize]
@@ -48,7 +50,7 @@
# suffix rules
-.SUFFIXES: .P .flr
+.SUFFIXES: ${PROLOGEXT} .flr
all: clean init recompile
@@ -58,7 +60,7 @@
@rm cmd...
@cat $(SVFILE)
-.flr.P:
+.flr${PROLOGEXT}:
echo 'flora_compile_system_module($*).' >> cmd...
init:
@@ -81,4 +83,4 @@
echo Done
clean:
- /bin/rm -f *.P *$(OBJEXT) *.O *.fdb *~ .*~ *.fld *.bak .#*
+ /bin/rm -f *${PROLOGEXT} *$(OBJEXT) *.O *.fdb *~ .*~ *.fld *.bak .#*
|
|
From: <ki...@us...> - 2002-06-17 07:00:43
|
Update of /cvsroot/flora/flora2
In directory usw-pr-cvs1:/tmp/cvs-serv11513
Modified Files:
flrutils.H flrporting.P NMakefile.mak Makefile
Added Files:
flrpretifydump.P
Removed Files:
flrprettyprint.P
Log Message:
Better pretty printer for prolog
Some makefile work
--- NEW FILE: flrpretifydump.P ---
/* File: flrpretifydump.P
**
** Author(s): Bin Tang
**
** Contact: flo...@li...
**
** Copyright (C) The Research Foundation of SUNY, 2002
**
** FLORA-2 is free software; you can redistribute it and/or modify it under the
** terms of the GNU Library General Public License as published by the Free
** Software Foundation; either version 2 of the License, or (at your option)
** any later version.
**
** FLORA-2 is distributed in the hope that it will be useful, but WITHOUT ANY
** WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
** FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for
** more details.
**
** You should have received a copy of the GNU Library General Public License
[...1182 lines suppressed...]
if unparsable -> can_strip_parens=0,continue
else if ambiguous -> can_strip_paren=0,fail and exit
else can_strip_paren=1.
**************************************************************************/
strip_parens_post([],_) :- !.
strip_parens_post(_,[]) :- !.
strip_parens_post(L1,L2) :-
L1 = [L1H|L1T], L2 = [L2H|L2T],
L1H = [_,Opa1,_], L2H = [_,Opa2,_],
(Opa1 == xf; Opa1 == yf),
( Opa1 == xf % unparsable
-> flora_set_counter(can_strip_parens,0),strip_parens_post(L1T,L2)
; Opa1 == yf, (Opa2 == xfy; Opa2 == fy) % ambiguous
-> flora_set_counter(can_strip_parens,0),throw(quit(a))
; flora_set_counter(can_strip_parens,1)
),
strip_parens_post(L1, L2T).
Index: flrutils.H
===================================================================
RCS file: /cvsroot/flora/flora2/flrutils.H,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- flrutils.H 14 Jun 2002 09:05:32 -0000 1.3
+++ flrutils.H 17 Jun 2002 07:00:24 -0000 1.4
@@ -145,7 +145,7 @@
flora_sysmod_file/3
from flrlibman.
-:- import prettyprint_stdin/0 from flrprettyprint.
+:- import prettyprint_stdin/0 from flrpretifydump.
:- import
flora_module_name/3,
Index: flrporting.P
===================================================================
RCS file: /cvsroot/flora/flora2/flrporting.P,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- flrporting.P 14 Jun 2002 09:05:32 -0000 1.11
+++ flrporting.P 17 Jun 2002 07:00:32 -0000 1.12
@@ -37,6 +37,7 @@
:- import eval/2 from eval.
:- import
slash/1, stat_flag/2,
+ str_len/2,
file_puttoken/3, file_writequoted/2
from machine.
:- import substring/4 from string.
@@ -54,6 +55,7 @@
flora_file_op/3,
flora_copy_input/0,
flora_user_home/1,
+ flora_atom_length/2,
flora_match_substring/3,
flora_match_substring/5,
flora_get_substring/4,
@@ -90,6 +92,10 @@
str_cat(Atom1,Atom2,Atom).
flora_concat_atoms([],'').
+
+
+flora_atom_length(Atom,Length) :- str_len(Atom, Length).
+
flora_get_counter(Counter,Value) :- conget(Counter,Value).
flora_set_counter(Counter,Value) :- conset(Counter,Value).
Index: NMakefile.mak
===================================================================
RCS file: /cvsroot/flora/flora2/NMakefile.mak,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- NMakefile.mak 27 May 2002 07:59:23 -0000 1.2
+++ NMakefile.mak 17 Jun 2002 07:00:34 -0000 1.3
@@ -25,6 +25,7 @@
##
OBJEXT = .xwam
+PROLOGEXT = .P
ALLOBJS = flrarguments$(OBJEXT) \
flrcomposer$(OBJEXT) \
@@ -55,7 +56,7 @@
!include .prolog_path
-.SUFFIXES: .P $(OBJEXT)
+.SUFFIXES: $(PROLOGEXT) $(OBJEXT)
ALL:: $(ALLOBJS)
cd p2h
@@ -107,7 +108,7 @@
cd ..
-.P$(OBJEXT):
+$(PROLOGEXT)$(OBJEXT):
$(PROLOG) -e "[flora2devel]. import bootstrap_flora/0 from flora2. bootstrap_flora,mc(%|fF,$(OPTIONS)). halt."
Index: Makefile
===================================================================
RCS file: /cvsroot/flora/flora2/Makefile,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- Makefile 10 Jun 2002 02:15:36 -0000 1.5
+++ Makefile 17 Jun 2002 07:00:35 -0000 1.6
@@ -26,6 +26,7 @@
##
OBJEXT=.xwam
+PROLOGEXT=.P
FLORADIR = .
@@ -43,7 +44,7 @@
flroperator${OBJEXT} \
flrparser${OBJEXT} \
flrporting${OBJEXT} \
- flrprettyprint${OBJEXT} \
+ flrpretifydump${OBJEXT} \
flrprint${OBJEXT} \
flrprolog${OBJEXT} \
flrregistry${OBJEXT} \
@@ -107,94 +108,94 @@
# always compile flora2devel to make sure that .xwam has the latest .flora_path
-flora2devel${OBJEXT} : flora2devel.P version.flh
+flora2devel${OBJEXT} : flora2devel${PROLOGEXT} version.flh
@echo 'mc(flora2devel,$(OPTION)).' >> cmd...
-flroperator${OBJEXT} : flroperator.P flroperator.H $(FLORA_TERMS)
+flroperator${OBJEXT} : flroperator${PROLOGEXT} flroperator.H $(FLORA_TERMS)
@echo 'mc(flroperator,$(OPTION)).' >> cmd...
-flrnodefp${OBJEXT} : flrnodefp.P flrnodefp.H $(FLORA_TERMS)
+flrnodefp${OBJEXT} : flrnodefp${PROLOGEXT} flrnodefp.H $(FLORA_TERMS)
@echo 'mc(flrnodefp,$(OPTION)).' >> cmd...
-flrnowsp${OBJEXT} : flrnowsp.P flrnowsp.H $(FLORA_TERMS)
+flrnowsp${OBJEXT} : flrnowsp${PROLOGEXT} flrnowsp.H $(FLORA_TERMS)
@echo 'mc(flrnowsp,$(OPTION)).' >> cmd...
-flrarguments${OBJEXT} : flrarguments.P flrarguments.H $(FLORA_TERMS)
+flrarguments${OBJEXT} : flrarguments${PROLOGEXT} flrarguments.H $(FLORA_TERMS)
@echo 'mc(flrarguments,$(OPTION)).' >> cmd...
-flrprolog${OBJEXT} : flrprolog.P flrprolog.H $(FLORA_TERMS)
+flrprolog${OBJEXT} : flrprolog${PROLOGEXT} flrprolog.H $(FLORA_TERMS)
@echo 'mc(flrprolog,$(OPTION)).' >> cmd...
-flrfirstorder${OBJEXT} : flrfirstorder.P flrfirstorder.H $(FLORA_TERMS)
+flrfirstorder${OBJEXT} : flrfirstorder${PROLOGEXT} flrfirstorder.H $(FLORA_TERMS)
@echo 'mc(flrfirstorder,$(OPTION)).' >> cmd...
-flrprint${OBJEXT} : flrprint.P flrprint.H
+flrprint${OBJEXT} : flrprint${PROLOGEXT} flrprint.H
@echo 'mc(flrprint,$(OPTION)).' >> cmd...
-flrlibman${OBJEXT} : flrlibman.P flrlibman.H $(FLORA_TERMS)
+flrlibman${OBJEXT} : flrlibman${PROLOGEXT} flrlibman.H $(FLORA_TERMS)
@echo 'mc(flrlibman,$(OPTION)).' >> cmd...
-flrlexer${OBJEXT} : flrlexer.P flrlexer.H $(FLORA_CHAR_DEFS) $(FLORA_TERMS) $(FLORA_ERRORS)
+flrlexer${OBJEXT} : flrlexer${PROLOGEXT} flrlexer.H $(FLORA_CHAR_DEFS) $(FLORA_TERMS) $(FLORA_ERRORS)
@echo 'mc(flrlexer,$(OPTION)).' >> cmd...
-flrcomposer${OBJEXT} : flrcomposer.P flrcomposer.H $(FLORA_CHAR_DEFS) $(FLORA_TERMS) $(FLORA_ERRORS)
+flrcomposer${OBJEXT} : flrcomposer${PROLOGEXT} flrcomposer.H $(FLORA_CHAR_DEFS) $(FLORA_TERMS) $(FLORA_ERRORS)
@echo 'mc(flrcomposer,$(OPTION)).' >> cmd...
-flrparser${OBJEXT} : flrparser.P flrparser.H $(FLORA_TERMS) $(FLORA_ERRORS)
+flrparser${OBJEXT} : flrparser${PROLOGEXT} flrparser.H $(FLORA_TERMS) $(FLORA_ERRORS)
@echo 'mc(flrparser,$(OPTION)).' >> cmd...
-flrcompiler${OBJEXT} : flrcompiler.P flrcompiler.H $(FLORA_TERMS) $(FLORA_ERRORS)
+flrcompiler${OBJEXT} : flrcompiler${PROLOGEXT} flrcompiler.H $(FLORA_TERMS) $(FLORA_ERRORS)
@echo 'mc(flrcompiler,$(OPTION)).' >> cmd...
-flrdependency${OBJEXT} : flrdependency.P flrdependency.H $(FLORA_TERMS)
+flrdependency${OBJEXT} : flrdependency${PROLOGEXT} flrdependency.H $(FLORA_TERMS)
@echo 'mc(flrdependency,$(OPTION)).' >> cmd...
-flrcoder${OBJEXT} : flrcoder.P flrcoder.H $(FLORA_CHAR_DEFS) $(FLORA_TERMS) $(FLORA_ERRORS)
+flrcoder${OBJEXT} : flrcoder${PROLOGEXT} flrcoder.H $(FLORA_CHAR_DEFS) $(FLORA_TERMS) $(FLORA_ERRORS)
@echo 'mc(flrcoder,$(OPTION)).' >> cmd...
-flrundefined${OBJEXT} : flrundefined.P flrundefined.H $(FLORA_TERMS)
+flrundefined${OBJEXT} : flrundefined${PROLOGEXT} flrundefined.H $(FLORA_TERMS)
@echo 'mc(flrundefined,$(OPTION)).' >> cmd...
-flrutils${OBJEXT} : flrutils.P flrutils.H $(FLORA_CHAR_DEFS) $(FLORA_TERMS)
+flrutils${OBJEXT} : flrutils${PROLOGEXT} flrutils.H $(FLORA_CHAR_DEFS) $(FLORA_TERMS)
@echo 'mc(flrutils,$(OPTION)).' >> cmd...
-flrwrapper${OBJEXT} : flrwrapper.P flrwrapper.H $(FLORA_TERMS)
+flrwrapper${OBJEXT} : flrwrapper${PROLOGEXT} flrwrapper.H $(FLORA_TERMS)
@echo 'mc(flrwrapper,$(OPTION)).' >> cmd...
-flrundefhook${OBJEXT} : flrundefhook.P flrundefhook.H $(FLORA_TERMS)
+flrundefhook${OBJEXT} : flrundefhook${PROLOGEXT} flrundefhook.H $(FLORA_TERMS)
@echo 'mc(flrundefhook,$(OPTION)).' >> cmd...
-flrshell${OBJEXT} : flrshell.P flrshell.H $(FLORA_TERMS)
+flrshell${OBJEXT} : flrshell${PROLOGEXT} flrshell.H $(FLORA_TERMS)
@echo 'mc(flrshell,$(OPTION)).' >> cmd...
-flrwraparound${OBJEXT} : flrwraparound.P flrwraparound.H $(FLORA_TERMS)
+flrwraparound${OBJEXT} : flrwraparound${PROLOGEXT} flrwraparound.H $(FLORA_TERMS)
@echo 'mc(flrwraparound,$(OPTION)).' >> cmd...
-flrprettyprint${OBJEXT} : flrprettyprint.P $(FLORA_TERMS)
- @echo 'mc(flrprettyprint,$(OPTION)).' >> cmd...
+flrpretifydump${OBJEXT} : flrpretifydump${PROLOGEXT} $(FLORA_TERMS)
+ @echo 'mc(flrpretifydump,$(OPTION)).' >> cmd...
-flrporting${OBJEXT} : flrporting.P $(FLORA_TERMS)
+flrporting${OBJEXT} : flrporting${PROLOGEXT} $(FLORA_TERMS)
@echo 'mc(flrporting,$(OPTION)).' >> cmd...
-flrregistry${OBJEXT} : flrregistry.P $(FLORA_TERMS)
+flrregistry${OBJEXT} : flrregistry${PROLOGEXT} $(FLORA_TERMS)
@echo 'mc(flrregistry,$(OPTION)).' >> cmd...
@@ -231,7 +232,7 @@
/bin/rm -f libinc/*~ libinc/.*~
/bin/rm -f includes/*~ includes/.*~
/bin/rm -f flrincludes/*~ flrincludes/.*~
- /bin/rm -f $(HOME)/.xsb/flora/*.P $(HOME)/.xsb/flora/*${OBJEXT}
+ /bin/rm -f $(HOME)/.xsb/flora/*${PROLOGEXT} $(HOME)/.xsb/flora/*${OBJEXT}
veryclean: clean
cd docs && $(MAKE) clean
--- flrprettyprint.P DELETED ---
|
|
From: <ki...@us...> - 2002-06-14 09:37:36
|
Update of /cvsroot/flora/flora-testsuite/general_tests
In directory usw-pr-cvs1:/tmp/cvs-serv3495
Modified Files:
meta_unification_old meta_unification.flr
Log Message:
more tests
Index: meta_unification_old
===================================================================
RCS file: /cvsroot/flora/flora-testsuite/general_tests/meta_unification_old,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- meta_unification_old 14 Jun 2002 09:07:10 -0000 1.1
+++ meta_unification_old 14 Jun 2002 09:37:33 -0000 1.2
@@ -8,6 +8,12 @@
tst12 succeeded, as expected = flapply(ans,dd,fllibmodlit(flapply,[a,dd],ff),ff,_$_$_flora'usermod'foo'd_fd(a,b,cc),foo)
tst13 succeeded, as expected = flapply(ans,_$_$_flora'usermod'main'd_fd(a,b,c),pp,main)
tst13 succeeded, as expected = flapply(ans,_$_$_flora'usermod'main'd_fd(a,b,c),pp,main)
+tst14 succeeded, as expected = flapply(ans,(_$_$_flora'usermod'foo'd_fd(a,b,c) ',' _$_$_flora'usermod'foo'd_fd(a,e,d)),foo)
+tst14 succeeded, as expected = flapply(ans,(_$_$_flora'usermod'foo'd_fd(a,b,c) ',' _$_$_flora'usermod'foo'd_fd(a,e,d)),foo)
+tst15 succeeded, as expected = flapply(ans,(_$_$_flora'usermod'foo'd_fd(a,b,c) ',' _$_$_flora'usermod'foo'd_fd(a,e,d)),foo)
+tst15 succeeded, as expected = flapply(ans,(_$_$_flora'usermod'foo'd_fd(a,b,c) ',' _$_$_flora'usermod'foo'd_fd(a,e,d)),foo)
+tst16 succeeded, as expected = flapply(ans,(_$_$_flora'usermod'foo'd_fd(a,b,c) ';' _$_$_flora'usermod'foo'd_fd(a,e,d)),foo)
+tst16 succeeded, as expected = flapply(ans,(_$_$_flora'usermod'foo'd_fd(a,b,c) ';' _$_$_flora'usermod'foo'd_fd(a,e,d)),foo)
tst2 succeeded, as expected = flapply(ans,_$_$_flora'usermod'foo'flapply(a,b),_$_$_flora'usermod'foo'flapply(a,b),foo)
tst2 succeeded, as expected = flapply(ans,_$_$_flora'usermod'foo'flapply(a,b),_$_$_flora'usermod'foo'flapply(a,b),foo)
tst3 succeeded, as expected = flapply(ans,fllibmodlit(libmod_wrapper,flapply(a,b),foo),fllibmodlit(libmod_wrapper,a,foo))
Index: meta_unification.flr
===================================================================
RCS file: /cvsroot/flora/flora-testsuite/general_tests/meta_unification.flr,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- meta_unification.flr 14 Jun 2002 09:07:10 -0000 1.1
+++ meta_unification.flr 14 Jun 2002 09:37:33 -0000 1.2
@@ -28,7 +28,17 @@
tst13 :- insert{p(${a[b->c]})}, p(X), X@Y ~ a[b->c]@Z, Y=pp,
writeln('tst13 succeeded, as expected'=ans(X,Y,Z))@prolog().
-pretest :- tst1,tst2,tst3,tst4,tst5,tst6,tst7,tst8,tst9,tst10,tst11,tst12,tst13.
+tst14 :- X ~ a[b->c,e->d]@foo, M=foo, X@M ~ a[b->c,e->d]@foo,
+ writeln('tst14 succeeded, as expected'=ans(X,M))@prolog().
+
+tst15 :- X ~ a[b->c,e->d]@foo, M=foo, X@M ~ a[b->c,e->d]@M,
+ writeln('tst15 succeeded, as expected'=ans(X,M))@prolog().
+
+tst16 :- X ~ a[b->c;e->d]@foo, M=foo, X@M ~ a[b->c;e->d]@M,
+ writeln('tst16 succeeded, as expected'=ans(X,M))@prolog().
+
+pretest :- tst1,tst2,tst3,tst4,tst5,tst6,tst7,tst8,tst9,tst10,tst11,tst12,
+ tst13,tst14,tst15,tst16.
test :- tell(temp)@prolog(),
pretest,
|
|
From: <ki...@us...> - 2002-06-14 09:35:54
|
Update of /cvsroot/flora/flora2/syslib In directory usw-pr-cvs1:/tmp/cvs-serv2681 Modified Files: flrmetaops.P Log Message: distribute meta-unification through conjunction and disjunction Index: flrmetaops.P =================================================================== RCS file: /cvsroot/flora/flora2/syslib/flrmetaops.P,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- flrmetaops.P 14 Jun 2002 09:05:32 -0000 1.2 +++ flrmetaops.P 14 Jun 2002 09:35:50 -0000 1.3 @@ -47,6 +47,30 @@ !, X=Y. +FLLIBUNIVEQFORM((X,XX),(Y,YY)) :- + FLLIBUNIVEQFORM(X,Y), + FLLIBUNIVEQFORM(XX,YY). + +FLLIBUNIVEQFORM((X,XX),FLLIBMODLIT(FL_LIBMOD,(Y,YY),M)) :- + FLLIBUNIVEQFORM(X,FLLIBMODLIT(FL_LIBMOD,Y,M)), + FLLIBUNIVEQFORM(XX,FLLIBMODLIT(FL_LIBMOD,YY,M)). + +FLLIBUNIVEQFORM(FLLIBMODLIT(FL_LIBMOD,(X,XX),M), (Y,YY)) :- + FLLIBUNIVEQFORM(FLLIBMODLIT(FL_LIBMOD,X,M),Y), + FLLIBUNIVEQFORM(FLLIBMODLIT(FL_LIBMOD,XX,M),YY). + +FLLIBUNIVEQFORM((X;XX),(Y;YY)) :- + FLLIBUNIVEQFORM(X,Y), + FLLIBUNIVEQFORM(XX,YY). + +FLLIBUNIVEQFORM((X;XX),FLLIBMODLIT(FL_LIBMOD,(Y;YY),M)) :- + FLLIBUNIVEQFORM(X,FLLIBMODLIT(FL_LIBMOD,Y,M)), + FLLIBUNIVEQFORM(XX,FLLIBMODLIT(FL_LIBMOD,YY,M)). + +FLLIBUNIVEQFORM(FLLIBMODLIT(FL_LIBMOD,(X;XX),M), (Y;YY)) :- + FLLIBUNIVEQFORM(FLLIBMODLIT(FL_LIBMOD,X,M),Y), + FLLIBUNIVEQFORM(FLLIBMODLIT(FL_LIBMOD,XX,M),YY). + %% Now neither X nor Y are variables %% Speed up the case of nonvar1@Var1 ~ nonvar2@Var2 |
Update of /cvsroot/flora/flora-testsuite/general_tests
In directory usw-pr-cvs1:/tmp/cvs-serv26442/general_tests
Modified Files:
reification_old
Added Files:
module_syntax_old module_syntax.flr meta_unification_old
meta_unification.flr
Log Message:
Added tests for the new enriched dynamic module syntax and meta unification
--- NEW FILE: module_syntax_old ---
test12: xx = ayy = def
tst1 = a + main
tst1 = a + main
tst10 = done
tst10 = done
tst11 = done
tst11 = done
tst13 = done
tst2 = def
tst2 = def
tst3 = def
tst3 = def
tst4 = abc
tst4 = abc
tst5 = abc
tst5 = abc
tst6 = _$_$_flora'usermod'foo'flapply(a)
tst6 = _$_$_flora'usermod'foo'flapply(a)
tst6 = _$_$_flora'usermod'foo'flapply(a,b)
tst6 = _$_$_flora'usermod'foo'flapply(a,b)
tst6 = _$_$_flora'usermod'main'flapply(c)
tst6 = _$_$_flora'usermod'main'flapply(c)
tst6 = _$_$_flora'usermod'main'flapply(e,f)
tst6 = _$_$_flora'usermod'main'flapply(e,f)
tst7 = done
tst7 = done
tst8 = done
tst8 = done
tst9 = done
tst9 = done
--- NEW FILE: module_syntax.flr ---
?- equality basic in foo.
?- insert{f, g@foo, p(abc), q(def)@foo, f(a)@ _@}.
r(_@) :- f(a).
%% Tests where X@foo, X@ _@, or X@Y occur at the top level
tst1 :- f, g@foo, f(X)@ _@, r(_@), writeln(tst1=X+ _@)@prolog().
tst2 :- X = q(Z), X@foo, Y=g, Y@foo, writeln(tst2=Z)@prolog().
tst3 :- X = q(Z), M=foo, X@M, Y=g, Y@M, writeln(tst3=Z)@prolog().
tst4 :- X=p(Z), Y=f, X@ _@, Y@ _@, writeln(tst4=Z)@prolog().
tst5 :- X=p(Z), Y=f, M= _@, X@M, Y@M, writeln(tst5=Z)@prolog().
?- insert{pr(a@foo), pr(a(b)@foo), pr(c@ _@), pr(e(f)@ _@)}.
tst6 :- pr(X), (X ~ Y@foo; X ~ Y@ _@), writeln(tst6=X)@prologall(), fail.
tst6 :- true.
%% Tests where X@foo, X@ _@, or X@Y occur in the argument position
tst7 :- pr(a@foo), pr(a(b)@foo), pr(c@ _@), pr(e(f)@ _@),
writeln(tst7=done)@prologall().
tst8 :- X=a, Y=foo, pr(X@foo), pr(X@Y), pr(a@Y),
writeln(tst8=done)@prologall().
tst9 :- X=a(b), Y=foo, pr(X@foo), pr(X@Y), pr(a@Y),
writeln(tst9=done)@prologall().
tst10 :- X=c, Y= _@, pr(X@ _@), pr(X@Y), pr(c@Y),
writeln(tst10=done)@prologall().
tst11 :- X=e(f), Y= _@, pr(X@ _@), pr(X@Y), pr(c@Y),
writeln(tst11=done)@prologall().
%% Tests X@Y where X is bound to a hilog predicate or F-logic molecule
tst12 :- X~f(XX), Y= ${q(YY)@foo}, X@foo, Y@bar, Z= ${f}, Z@ _@, ZZ~f, ZZ@foo,
(write('test12: '), write(xx=XX), writeln(yy=YY))@prologall().
tst13 :- X~a@foo, pr(X@bar), Y= ${a(b)@foo}, pr(Y@bar), pr(Y@ _@),
writeln(tst13=done)@prolog().
test :- tell(temp)@prolog(),
tst1, tst2, tst3, tst4, tst5, tst6, tst7, tst8, tst9, tst10, tst11,
tst12, tst13,
debug[#check_undefined(on)]@flora(sys),
tst1, tst2, tst3, tst4, tst5, tst6, tst7, tst8, tst9, tst10, tst11,
told@prolog().
--- NEW FILE: meta_unification_old ---
tst1 failed as expected
tst1 failed as expected
tst10 succeeded, as expected = flapply(ans,_$_$_flora'usermod'foo'd_fd(a,b,cc),foo,a,b,cc)
tst10 succeeded, as expected = flapply(ans,_$_$_flora'usermod'foo'd_fd(a,b,cc),foo,a,b,cc)
tst11 succeeded, as expected = flapply(ans,fllibmodlit(d_fd,[a,b,cc],foo),foo,foo,a,b,cc)
tst11 succeeded, as expected = flapply(ans,fllibmodlit(d_fd,[a,b,cc],foo),foo,foo,a,b,cc)
tst12 succeeded, as expected = flapply(ans,dd,fllibmodlit(flapply,[a,dd],ff),ff,_$_$_flora'usermod'foo'd_fd(a,b,cc),foo)
tst12 succeeded, as expected = flapply(ans,dd,fllibmodlit(flapply,[a,dd],ff),ff,_$_$_flora'usermod'foo'd_fd(a,b,cc),foo)
tst13 succeeded, as expected = flapply(ans,_$_$_flora'usermod'main'd_fd(a,b,c),pp,main)
tst13 succeeded, as expected = flapply(ans,_$_$_flora'usermod'main'd_fd(a,b,c),pp,main)
tst2 succeeded, as expected = flapply(ans,_$_$_flora'usermod'foo'flapply(a,b),_$_$_flora'usermod'foo'flapply(a,b),foo)
tst2 succeeded, as expected = flapply(ans,_$_$_flora'usermod'foo'flapply(a,b),_$_$_flora'usermod'foo'flapply(a,b),foo)
tst3 succeeded, as expected = flapply(ans,fllibmodlit(libmod_wrapper,flapply(a,b),foo),fllibmodlit(libmod_wrapper,a,foo))
tst3 succeeded, as expected = flapply(ans,fllibmodlit(libmod_wrapper,flapply(a,b),foo),fllibmodlit(libmod_wrapper,a,foo))
tst4 failed as expected
tst4 failed as expected
tst5 succeeded, as expected = flapply(ans,_$_$_flora'usermod'bar'flapply(a,b),bar,_$_$_flora'usermod'bar'flapply(a,b),bar)
tst5 succeeded, as expected = flapply(ans,_$_$_flora'usermod'bar'flapply(a,b),bar,_$_$_flora'usermod'bar'flapply(a,b),bar)
tst6 succeeded, as expected = flapply(ans,fllibmodlit(libmod_wrapper,flapply(a,b),foo),flapply(a,b))
tst6 succeeded, as expected = flapply(ans,fllibmodlit(libmod_wrapper,flapply(a,b),foo),flapply(a,b))
tst7 succeeded, as expected = flapply(ans,fllibmodlit(libmod_wrapper,flapply(a,b),foo),flapply(a,b),bar,bar)
tst7 succeeded, as expected = flapply(ans,fllibmodlit(libmod_wrapper,flapply(a,b),foo),flapply(a,b),bar,bar)
tst8 succeeded, as expected = flapply(ans,foo,_$_$_flora'usermod'foo'flapply(a,b),foo)
tst8 succeeded, as expected = flapply(ans,foo,_$_$_flora'usermod'foo'flapply(a,b),foo)
tst9 failed as expected
tst9 failed as expected
--- NEW FILE: meta_unification.flr ---
tst1 :- unless a(b) ~ X@foo
do writeln('tst1 failed as expected')@prolog().
tst2 :- a(b)@foo ~ X@foo, Y = foo, a(b)@Y ~ X@foo, Z=a(b), Z@Y ~ X@foo,
a(b)@foo ~ XX@YY,
writeln('tst2 succeeded, as expected'=ans(X,XX,YY))@prolog().
tst3 :- X ~ Y@foo, Z@foo ~ V, Z=a, Y=a(b),
writeln('tst3 succeeded, as expected'=ans(X,V))@prolog().
tst4 :- unless a(b)@foo ~ X@bar do writeln('tst4 failed as expected')@prolog().
tst5 :- a(b)@M ~ X@bar, Y@bar ~ a(b)@MM,
writeln('tst5 succeeded, as expected'=ans(X,M,Y,MM))@prolog().
tst6 :- X ~ Y@foo, Y=a(b), X~a(b)@foo,
writeln('tst6 succeeded, as expected'=ans(X,Y))@prolog().
tst7 :- X ~ Y@foo, Y=a(b), Y@Z ~a(b)@W, W=bar,
writeln('tst7 succeeded, as expected'=ans(X,Y,Z,W))@prolog().
tst8 :- a(b)@X ~ Y@foo, Y@Z ~a(b)@W, Z=pp,
writeln('tst8 succeeded, as expected'=ans(X,Y,W))@prolog().
tst9 :- unless (a(b)@X ~ Y@foo, Y@Z ~a(b)@pp)
do writeln('tst9 failed as expected')@prolog().
tst10 :- a[b->C]@foo ~ X@Z, X= ${A[B->cc]@foo},
writeln('tst10 succeeded, as expected'=ans(X,Z,A,B,C))@prolog().
tst11 :- a[b->C]@M ~ X@Z, X~ A[B->cc]@foo,
writeln('tst11 succeeded, as expected'=ans(X,Z,M,A,B,C))@prolog().
tst12 :- a(X)@M ~ Y@Z, X=dd, Z = ff, XX@YY ~ a[b->cc]@foo,
writeln('tst12 succeeded, as expected'=ans(X,Y,Z,XX,YY))@prolog().
tst13 :- insert{p(${a[b->c]})}, p(X), X@Y ~ a[b->c]@Z, Y=pp,
writeln('tst13 succeeded, as expected'=ans(X,Y,Z))@prolog().
pretest :- tst1,tst2,tst3,tst4,tst5,tst6,tst7,tst8,tst9,tst10,tst11,tst12,tst13.
test :- tell(temp)@prolog(),
pretest,
debug[#check_undefined(on)]@flora(sys),
pretest,
told@prolog().
Index: reification_old
===================================================================
RCS file: /cvsroot/flora/flora-testsuite/general_tests/reification_old,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- reification_old 18 May 2002 16:08:36 -0000 1.1.1.1
+++ reification_old 14 Jun 2002 09:07:10 -0000 1.2
@@ -1,9 +1,9 @@
Tst4: ok
tst1: (_$_$_flora'usermod'foo'd_fd(a,b,c) ',' _$_$_flora'usermod'foo'd_meth(c,e))
tst1: (_$_$_flora'usermod'foo'd_fd(a,b,c) ',' _$_$_flora'usermod'foo'd_meth(c,e))
-tst2: [(_$_$_flora'usermod'main'mvd(alice,thinks,flora) ',' _$_$_flora'usermod'main'isa(flora,cool)),_$_$_flora'usermod'main'mvd(sally,thinks,_$_$_flora'usermod'main'isa(flora,cool))]
-tst2: [(_$_$_flora'usermod'main'mvd(alice,thinks,flora) ',' _$_$_flora'usermod'main'isa(flora,cool)),_$_$_flora'usermod'main'mvd(sally,thinks,_$_$_flora'usermod'main'isa(flora,cool))]
+tst2: [(_$_$_flora'usermod'main'd_mvd(alice,thinks,flora) ',' _$_$_flora'usermod'main'd_isa(flora,cool)),_$_$_flora'usermod'main'd_mvd(sally,thinks,_$_$_flora'usermod'main'd_isa(flora,cool))]
+tst2: [(_$_$_flora'usermod'main'd_mvd(alice,thinks,flora) ',' _$_$_flora'usermod'main'd_isa(flora,cool)),_$_$_flora'usermod'main'd_mvd(sally,thinks,_$_$_flora'usermod'main'd_isa(flora,cool))]
tst3: (_$_$_flora'usermod'bar'd_isa(b,a) ',' _$_$_flora'usermod'bar'd_fd(b,b,c))
tst3: (_$_$_flora'usermod'bar'd_isa(b,a) ',' _$_$_flora'usermod'bar'd_fd(b,b,c))
-tst4: P = _$_$_flora'usermod'main'mvd(mary,thinks,_$_$_flora'usermod'main'isa(flora,cool))
-tst4: _$_$_flora'usermod'main'mvd(mary,thinks,_$_$_flora'usermod'main'isa(flora,cool))
+tst4: P = _$_$_flora'usermod'main'd_mvd(mary,thinks,_$_$_flora'usermod'main'd_isa(flora,cool))
+tst4: _$_$_flora'usermod'main'd_mvd(mary,thinks,_$_$_flora'usermod'main'd_isa(flora,cool))
|
|
From: <ki...@us...> - 2002-06-14 09:05:37
|
Update of /cvsroot/flora/flora2/p2h
In directory usw-pr-cvs1:/tmp/cvs-serv25757/p2h
Modified Files:
prolog2hilog.c prolog2hilog.H
Log Message:
1. Parser, compiler, coder: Allow things like X@..., where X is a variable
2. Compiler, coder: make sure that reified statements are encoded as body
literals even if they occur in the head.
Otherwise won't be able to match queries against facts.
3. Fixes in prologall() and prolog2hilog conversion. Seems to work correctly
now.
4. Changed syslib/flrmetaops.P and syslib/flrdynmod.P so that they'll work
with the richer X@... syntax.
Index: prolog2hilog.c
===================================================================
RCS file: /cvsroot/flora/flora2/p2h/prolog2hilog.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- prolog2hilog.c 18 May 2002 17:43:28 -0000 1.1.1.1
+++ prolog2hilog.c 14 Jun 2002 09:05:32 -0000 1.2
@@ -46,16 +46,16 @@
/* take hilog term and a hilog apply op and return prolog term.
If the apply term is != the one used in the hilog term, assume it is already
a prolog term and don't convert */
-static prolog_term hilog2prolog(prolog_term hterm, char *apply);
+static prolog_term hilog2prolog(prolog_term hterm, char *apply, int unify_vars);
/* take prolog term and a symbol name of the apply operator and return hilog
term. If prolog term already has the main functor==hilog apply, then don't
convert. */
-static prolog_term prolog2hilog(prolog_term pterm, char *apply);
+static prolog_term prolog2hilog(prolog_term pterm, char *apply, int unify_vars);
static char *pterm2string(prolog_term term);
inline static int is_hilog(prolog_term term, char *apply_funct);
-inline static int is_commalist(prolog_term term);
-static prolog_term map_commalist(prolog_term (*func)(), prolog_term term, char *apply);
-static prolog_term map_list(prolog_term func(), prolog_term term, char *apply);
+inline static int is_special_form(prolog_term term);
+static prolog_term map_special_form(prolog_term (*func)(), prolog_term term, char *apply, int unify_vars);
+static prolog_term map_list(prolog_term func(), prolog_term term, char *apply, int unify_vars);
/*
@@ -63,6 +63,7 @@
- Pterm: Prolog term
- Hterm: HiLog term
- Apply: Symbol name for the HiLog apply predicate
+ - UnifyGlag: If true, unify if both Pterm and Hterm are variables
If Pterm is a variable, then it is unified with Hterm.
If Hterm is a variable, then it is unified with Pterm.
@@ -86,28 +87,29 @@
term and the term is simply returned without change.
For instance,
- plg2hlg(f(a,g(b,X)),Y,abc)
+ flora_plg2hlg(f(a,g(b,X)),Y,abc)
Y = abc(f,a,abc(g,b,_h123))
- plg2hlg(X, cde(f,a,cde(g,b,Y))),Z)
+ flora_plg2hlg(X, cde(f,a,cde(g,b,Y))),Z)
X = abc(f,a,abc(g,b,_h123))
Z = abc
Doesn't do occur-check!!! Something like
- plg2hlg(X, cde(f,a,cde(g,b,X))),Z)
+ flora_plg2hlg(X, cde(f,a,cde(g,b,X))),Z)
Will loop and eventually crash because X occurs in Pterm and in Hterm.
*/
-DllExport xsbBool call_conv plg2hlg () {
+DllExport xsbBool call_conv flora_plg2hlg () {
prolog_term pterm = reg_term(1);
prolog_term hterm = reg_term(2);
prolog_term apply_t = reg_term(3);
- prolog_term temp_pterm;
+ int unify_vars = ptoc_int(4); /* whether to unify if both args are vars */
+ prolog_term temp_term;
char *apply;
#ifdef P2HDEBUG_VERBOSE
- xsb_dbgmsg("plg2hlg: Arg1=%s", pterm2string(pterm));
- xsb_dbgmsg("plg2hlg: Arg2=%s", pterm2string(hterm));
- xsb_dbgmsg("plg2hlg: Arg3=%s", pterm2string(apply_t));
+ xsb_dbgmsg("flora_plg2hlg: Arg1=%s", pterm2string(pterm));
+ xsb_dbgmsg("flora_plg2hlg: Arg2=%s", pterm2string(hterm));
+ xsb_dbgmsg("flora_plg2hlg: Arg3=%s", pterm2string(apply_t));
#endif
if (!is_atom(apply_t))
@@ -116,20 +118,25 @@
apply = string_val(apply_t);
- if (is_var(pterm)) {
- /* prolog term is variable; convert hilog to prolog */
- if (is_var(hterm))
- return p2p_unify(pterm, hterm);
-
- temp_pterm = hilog2prolog(hterm, apply);
- return p2p_unify(pterm, temp_pterm);
+ /* both are variables */
+ if (is_var(pterm) && is_var(hterm)) {
+ if (unify_vars)
+ return p2p_unify(pterm,hterm);
+ else
+ return TRUE;
+ }
- } else {
- temp_pterm = prolog2hilog(pterm, apply);
- /* prolog term is instantiated; convert to hilog */
- return p2p_unify(temp_pterm, hterm);
+ /* if hilog is instantiated, convert from hilog to prolog
+ and unify, because hilog->prolog conversion is more accurate */
+ if (!is_var(hterm)) {
+ temp_term = hilog2prolog(hterm, apply,unify_vars);
+ return p2p_unify(temp_term, pterm);
}
- return TRUE; /* this is unreachable---just to pacify the compiler */
+
+ /* hterm is a variable and pterm is not */
+ temp_term = prolog2hilog(pterm, apply, unify_vars);
+
+ return p2p_unify(temp_term, hterm);
}
static inline xsbBool is_scalar(prolog_term pterm)
@@ -140,21 +147,25 @@
}
-static prolog_term hilog2prolog(prolog_term hterm, char *apply)
+static prolog_term hilog2prolog(prolog_term hterm, char *apply, int unify_vars)
{
prolog_term pterm = p2p_new();
prolog_term pfunctor;
int arity, i;
- if (is_var(hterm))
- return hterm;
- else if (is_list(hterm))
- return map_list(hilog2prolog,hterm,apply);
- else if (is_commalist(hterm))
- return map_commalist(hilog2prolog,hterm,apply);
+ if (is_var(hterm)){
+ if (unify_vars)
+ return hterm;
+ else
+ return pterm; /* don't reuse input vars: make new ones */
+ }
+ if (is_scalar(hterm)) return hterm;
+
+ if (is_list(hterm))
+ return map_list(hilog2prolog,hterm,apply,unify_vars);
+ else if (is_special_form(hterm))
+ return map_special_form(hilog2prolog,hterm,apply,unify_vars);
- if (is_scalar(hterm) || is_var(hterm))
- return hterm;
#ifdef P2HDEBUG
if (!is_functor(hterm))
xsb_abort("PLG2HLG: Arg 2 =`%s' is not a HiLog term.",
@@ -182,7 +193,7 @@
#endif
for (i=2; i<=arity; i++) {
- p2p_unify(hilog2prolog(p2p_arg(hterm,i), apply),
+ p2p_unify(hilog2prolog(p2p_arg(hterm,i), apply,unify_vars),
p2p_arg(pterm, i-1));
#ifdef P2HDEBUG_VERBOSE
xsb_dbgmsg("h2p loop: Pterm=%s", pterm2string(pterm));
@@ -192,20 +203,24 @@
}
-static prolog_term prolog2hilog(prolog_term pterm, char *apply)
+static prolog_term prolog2hilog(prolog_term pterm, char *apply, int unify_vars)
{
prolog_term hterm = p2p_new();
int arity, i;
- if (is_var(pterm))
- return pterm;
- else if (is_list(pterm))
- return map_list(prolog2hilog,pterm,apply);
- else if (is_commalist(pterm))
- return map_commalist(prolog2hilog,pterm,apply);
+ if (is_var(pterm)) {
+ if (unify_vars)
+ return pterm;
+ else
+ return hterm; /* don't reuse input vars: create new */
+ }
+ if (is_scalar(pterm)) return pterm;
+
+ if (is_list(pterm))
+ return map_list(prolog2hilog,pterm,apply, unify_vars);
+ else if (is_special_form(pterm))
+ return map_special_form(prolog2hilog,pterm,apply, unify_vars);
- if (is_scalar(pterm) || is_var(pterm))
- return pterm;
if (!is_functor(pterm))
xsb_abort("PLG2HLG: Arg 1 = `%s' (the Prolog term) must be a var, a const, or a functor.",
pterm2string(pterm));
@@ -225,7 +240,7 @@
/* set the rest of the args */
for (i=1; i<=arity; i++) {
- p2p_unify(prolog2hilog(p2p_arg(pterm,i),apply), p2p_arg(hterm,i+1));
+ p2p_unify(prolog2hilog(p2p_arg(pterm,i),apply, unify_vars), p2p_arg(hterm,i+1));
#ifdef P2HDEBUG_VERBOSE
xsb_dbgmsg("p2h loop: Hterm=%s", pterm2string(hterm));
#endif
@@ -234,7 +249,7 @@
}
-static prolog_term map_list(prolog_term func(), prolog_term termList, char *apply)
+static prolog_term map_list(prolog_term func(), prolog_term termList, char *apply, int unify_vars)
{
prolog_term listHead, listTail;
prolog_term outList=p2p_new(), outListHead, outListTail;
@@ -247,7 +262,7 @@
while (!is_nil(listTail)) {
listHead = p2p_car(listTail);
outListHead = p2p_car(outListTail);
- temp_term = func(listHead,apply);
+ temp_term = func(listHead,apply, unify_vars);
p2p_unify(outListHead, temp_term);
listTail = p2p_cdr(listTail);
outListTail = p2p_cdr(outListTail);
@@ -259,30 +274,21 @@
return outList;
}
-static prolog_term map_commalist(prolog_term (*func)(), prolog_term termCList, char *apply)
+static prolog_term map_special_form(prolog_term (*func)(), prolog_term special_form, char *apply, int unify_vars)
{
- prolog_term clistHead, clistTail;
- prolog_term outCList=p2p_new(), outCListHead, outCListTail;
- prolog_term temp_term;
- char *clist_functor = ",";
-
- c2p_functor(clist_functor, 2, outCList);
- outCListTail = outCList;
- clistTail = termCList;
+ prolog_term formArg1_temp, formArg2_temp;
+ prolog_term out_form=p2p_new(), formArg1_out, formArg2_out;
+ char *functor = p2c_functor(special_form);
- while (is_commalist(clistTail)) {
- clistHead = p2p_arg(clistTail,1);
- outCListHead = p2p_arg(outCListTail,1);
- temp_term = func(clistHead,apply);
- p2p_unify(temp_term,outCListHead);
- clistTail = p2p_arg(clistTail,2);
- outCListTail = p2p_arg(outCListTail,2);
- if (is_commalist(clistTail))
- c2p_functor(clist_functor, 2, outCListTail);
- }
+ c2p_functor(functor, 2, out_form);
+ formArg1_out = p2p_arg(out_form,1);
+ formArg2_out = p2p_arg(out_form,2);
+ formArg1_temp = func(p2p_arg(special_form,1),apply, unify_vars);
+ formArg2_temp = func(p2p_arg(special_form,2),apply, unify_vars);
+ p2p_unify(formArg1_out,formArg1_temp);
+ p2p_unify(formArg2_out,formArg2_temp);
- p2p_unify(outCListTail,func(clistTail,apply));
- return outCList;
+ return out_form;
}
@@ -298,7 +304,7 @@
}
-inline static int is_hilog(prolog_term term, char *apply_funct)
+static int is_hilog(prolog_term term, char *apply_funct)
{
size_t length_diff;
char *func = p2c_functor(term); /* term functor */
@@ -314,30 +320,66 @@
}
-inline static int is_commalist(prolog_term term)
+/* Note: this only treats 2-ary 1-character functors that are treated as
+ prolog in Flora. We don't do it for others due to speed considerations. */
+static int is_special_form(prolog_term term)
{
+ char *functor;
if (is_scalar(term) || is_list(term)) return FALSE;
- return (strcmp(",", p2c_functor(term))==0);
+
+ functor = p2c_functor(term);
+ if (strlen(functor)==1) {
+ switch (*functor) {
+ case ',':
+ case ';':
+ case '+':
+ case '-':
+ case '/':
+ case '*':
+ case '>':
+ case '<':
+ case '~': return TRUE;
+ default: return FALSE;
+ }
+ }
+ return FALSE;
}
/*
- plg2hlg(a(qq,b(c,4),b(c,5,d(X,U))),Y,aaa).
- plg2hlg(aaa(qq,b(c,4)),X,aaa).
- plg2hlg(X, aaa(qq,b(c,4),aaa(kkk,Bbb,aaa(ppp,aaa(uuu,Aaa),Ooo))),aaa).
- plg2hlg(X, aaa(qq,aaa(aaa,4)),aaa).
- plg2hlg(X, [], aaa).
- plg2hlg([], X, aaa).
- plg2hlg(X, [aaa(qq,b(c,4)), f(abc), aaa(b,c(K),aaa(bbb,aaa(ccc,aaa(ddd))))],aaa).
- plg2hlg(X, [aaa(qq,b(c,4)), f(abc), aaa(b,c(K))],aaa).
- plg2hlg(X, [[aaa(qq,b(c,4)), f(abc)], aaa(b,c(K))],aaa).
- plg2hlg([aaa(qq,b(c,4)), a(qq,b(c,4)), f(q(a),b,c(p,q(Y)))], X, aaa).
- plg2hlg([aaa(qq,b(c,4)), [a(qq,b(c,4))], [f(q(a),b,c(p,q(Y))), b(_)]], X, aaa).
- plg2hlg(X, (aaa(qq,b(c,4)), f(abc), aaa(b,c(K),aaa(bbb,aaa(ccc,aaa(ddd))))),aaa).
- plg2hlg(X, (aaa(qq,b(c,4)), f(abc), aaa(b,c(K))),aaa).
- plg2hlg(X, ((aaa(qq,b(c,4)), f(abc)), aaa(b,c(K))),aaa).
- plg2hlg((aaa(qq,b(c,4)), a(qq,b(c,4)), f(q(a),b,c(p,q(Y)))), X, aaa).
- plg2hlg((aaa(qq,b(c,4)), a(qq,b(c,4)), f(q(a),b,c(p,q(Y)))), X, aaa).
- plg2hlg(((aaa(qq,b(c,4)), a(qq,b(c,4))), (f(q(a),b,c(p,q(Y))), b(_))), X, aaa).
+ flora_plg2hlg(a(qq,b(c,4),b(c,5,d(X,U))),Y,aaa,1).
+ Y = aaa(a,qq,aaa(b,c,4),aaa(b,c,5,aaa(d,_h312,_h313)))
+ flora_plg2hlg(aaa(qq,b(c,4)),X,aaa,1).
+ X = aaa(qq,b(c,4))
+ flora_plg2hlg(X, aaa(qq,b(c,4),aaa(kkk,Bbb,aaa(ppp,aaa(uuu,Aaa),Ooo))),aaa,1).
+ X = qq(b(c,4),kkk(_h356,ppp(uuu(_h365),_h362)))
+ flora_plg2hlg(X, aaa(qq,aaa(aaa,4)),aaa,1).
+ X = qq(aaa(4))
+ flora_plg2hlg(X, [], aaa,1).
+ X = []
+ flora_plg2hlg([], X, aaa,1).
+ X = []
+ flora_plg2hlg(X, [aaa(qq,b(c,4)), f(abc), aaa(b,c(K),aaa(bbb,aaa(ccc,aaa(ddd))))],aaa,1).
+ X = [qq(b(c,4)),f(abc),b(c(_h185),bbb(ccc(ddd)))]
+ flora_plg2hlg(X, [aaa(qq,b(c,4)), f(abc), aaa(b,c(K))],aaa,1).
+ X = [qq(b(c,4)),f(abc),b(c(_h185))]
+ flora_plg2hlg(X, [[aaa(qq,b(c,4)), f(abc)], aaa(b,c(K))],aaa,1).
+ X = [[qq(b(c,4)),f(abc)],b(c(_h193))]
+ flora_plg2hlg([aaa(qq,b(c,4)), a(qq,b(c,4)), f(q(a),b,c(p,q(Y)))], X, aaa,1).
+ X = [aaa(qq,b(c,4)),aaa(a,qq,aaa(b,c,4)),aaa(f,aaa(q,a),b,aaa(c,p,aaa(q,_h423)))]
+ flora_plg2hlg([aaa(qq,b(c,4)), [a(qq,b(c,4))], [f(q(a),b,c(p,q(Y))), b(_)]], X, aaa,1).
+ X = [aaa(qq,b(c,4)),[aaa(a,qq,aaa(b,c,4))],[aaa(f,aaa(q,a),b,aaa(c,p,aaa(q,_h480))),aaa(b,_h487)]]
+ flora_plg2hlg(X, (aaa(qq,b(c,4)), f(abc), aaa(b,c(K),aaa(bbb,aaa(ccc,aaa(ddd))))),aaa,1).
+ X = (qq(b(c,4)) ',' f(abc) ',' b(c(_h185),bbb(ccc(ddd))))
+ flora_plg2hlg(X, (aaa(qq,b(c,4)), f(abc), aaa(b,c(K))),aaa,1).
+ X = (qq(b(c,4)) ',' f(abc) ',' b(c(_h185)))
+ flora_plg2hlg(X, ((aaa(qq,b(c,4)); f(abc)), aaa(b,c(K))),aaa,1).
+ X = ((qq(b(c,4)) ';' f(abc)) ',' b(c(_h193)))
+ flora_plg2hlg((aaa(qq,b(c,4)); a(qq,b(c,4)), f(q(a),b,c(p,q(Y)))), X,aaa,1).
+ X = (aaa(qq,b(c,4)) ';' aaa(a,qq,aaa(b,c,4)) ',' aaa(f,aaa(q,a),b,aaa(c,p,aaa(q,_h427))))
+ flora_plg2hlg((aaa(qq,b(c,4)), a(qq,b(c,4)), f(q(a),b,c(p,q(Y)))), X,aaa,1).
+ X = (aaa(qq,b(c,4)) ',' aaa(a,qq,aaa(b,c,4)) ',' aaa(f,aaa(q,a),b,aaa(c,p,aaa(q,_h427))))
+ flora_plg2hlg(((aaa(qq,b(c,4)), a(qq,b(c,4))); (f(q(a),b,c(p,q(Y))), b(_))), X, aaa,1).
+ X= (aaa(qq,b(c,4)) ',' aaa(a,qq,aaa(b,c,4)) ';' aaa(f,aaa(q,a),b,aaa(c,p,aaa(q,_h480))) ',' aaa(b,_h485))
*/
Index: prolog2hilog.H
===================================================================
RCS file: /cvsroot/flora/flora2/p2h/prolog2hilog.H,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- prolog2hilog.H 18 May 2002 17:43:28 -0000 1.1.1.1
+++ prolog2hilog.H 14 Jun 2002 09:05:32 -0000 1.2
@@ -1,2 +1,2 @@
-:- export plg2hlg/3.
+:- export flora_plg2hlg/4.
|
|
From: <ki...@us...> - 2002-06-14 09:05:36
|
Update of /cvsroot/flora/flora2/flrincludes In directory usw-pr-cvs1:/tmp/cvs-serv25757/flrincludes Modified Files: flora_terms.flh flora_errors.flh Log Message: 1. Parser, compiler, coder: Allow things like X@..., where X is a variable 2. Compiler, coder: make sure that reified statements are encoded as body literals even if they occur in the head. Otherwise won't be able to match queries against facts. 3. Fixes in prologall() and prolog2hilog conversion. Seems to work correctly now. 4. Changed syslib/flrmetaops.P and syslib/flrdynmod.P so that they'll work with the richer X@... syntax. Index: flora_terms.flh =================================================================== RCS file: /cvsroot/flora/flora2/flrincludes/flora_terms.flh,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- flora_terms.flh 2 Jun 2002 18:51:00 -0000 1.3 +++ flora_terms.flh 14 Jun 2002 09:05:32 -0000 1.4 @@ -190,6 +190,8 @@ #define FL_EXPUNGE expunge #define FL_IN (in) +#define FL_LIBMOD libmod_wrapper + #define FL_MIN min #define FL_MAX max #define FL_SUM sum @@ -306,6 +308,7 @@ #define FLFIRSTORDER flfirstorder #define FLINDEX flindex #define FLHILOGTABLE flhilogtable +%%#define FLTHISMODULE flthismodule #define FLEQUALITY flequality #define FLEXPUNGE flexpunge #define FLFLOGICSTATIC flflogicstatic @@ -367,6 +370,12 @@ /**************************************************************************** + Flags that control the behavior of flP2H, plg2hlg +****************************************************************************/ +#define P2H_UNIFY_VARS 1 +#define P2H_DONOT_UNIFY_VARS 0 + +/**************************************************************************** Prolog encoding of a compiled FLORA program ****************************************************************************/ #define PRRULE prrule @@ -374,6 +383,8 @@ #define PRFACT prfact #define PRQUERY prquery #define PRDIRECTIVE prdirective + +#define PRREIFY prreify #define PRCONSTRAINT prconstraint Index: flora_errors.flh =================================================================== RCS file: /cvsroot/flora/flora2/flrincludes/flora_errors.flh,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- flora_errors.flh 18 May 2002 17:43:28 -0000 1.1.1.1 +++ flora_errors.flh 14 Jun 2002 09:05:32 -0000 1.2 @@ -88,7 +88,6 @@ #mode restore #define ERROR_ARGUMENTS 'invalid arguments directive' -#define ERROR_PROLOGMODULE 'invalid module name' #define ERROR_AGGREGT 'syntax error in aggregate body' #define ERROR_BDLITERAL 'invalid literal/molecule in rule/query body' #define ERROR_PRLGLIT 'invalid PROLOG literal' |
|
From: <ki...@us...> - 2002-06-14 09:05:36
|
Update of /cvsroot/flora/flora2
In directory usw-pr-cvs1:/tmp/cvs-serv25757
Modified Files:
flrwrapper.P flrwrapper.H flrutils.P flrutils.H flrshell.H
flrprolog.P flrporting.P flrparser.P flrlexer.P
flrdependency.P flrdependency.H flrcompiler.P flrcoder.P
flrcoder.H
Log Message:
1. Parser, compiler, coder: Allow things like X@..., where X is a variable
2. Compiler, coder: make sure that reified statements are encoded as body
literals even if they occur in the head.
Otherwise won't be able to match queries against facts.
3. Fixes in prologall() and prolog2hilog conversion. Seems to work correctly
now.
4. Changed syslib/flrmetaops.P and syslib/flrdynmod.P so that they'll work
with the richer X@... syntax.
Index: flrwrapper.P
===================================================================
RCS file: /cvsroot/flora/flora2/flrwrapper.P,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- flrwrapper.P 10 Jun 2002 02:15:36 -0000 1.2
+++ flrwrapper.P 14 Jun 2002 09:05:32 -0000 1.3
@@ -62,7 +62,7 @@
It fails if the input is not a valid Flora module name. It is used for
either F-logic or HiLog wrapper predicates.
*****************************************************************************/
-%% Tabling r\this expensive predicate can speed up dynamic module calls
+%% Tabling this expensive predicate can speed up dynamic module calls
%% like foo@X
:- table flora_module_predicate/4.
Index: flrwrapper.H
===================================================================
RCS file: /cvsroot/flora/flora2/flrwrapper.H,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- flrwrapper.H 18 May 2002 17:43:26 -0000 1.1.1.1
+++ flrwrapper.H 14 Jun 2002 09:05:32 -0000 1.2
@@ -77,6 +77,7 @@
flora_decode_predicate/6,
flora_decode_module_name/2,
+ flora_decode_module_prefix/3,
flora_is_flogic_wrapper/3,
flora_is_dynamic_flogic_base/2.
Index: flrutils.P
===================================================================
RCS file: /cvsroot/flora/flora2/flrutils.P,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- flrutils.P 3 Jun 2002 04:28:25 -0000 1.3
+++ flrutils.P 14 Jun 2002 09:05:32 -0000 1.4
@@ -855,7 +855,7 @@
stat_set_flag(CURRENT_INPUT,IOportFromProc),
flora_measure_time(
flora_rpc_file(MaxErrNum,0,0,CompiledRuleList,FileOptionList,CompileStatus),
- 'Compiling '),
+ 'Compile time '),
%% Wait, to not leave zombies.
process_control(XPP_process,wait(ExitStatus)),
(ExitStatus==0, !
@@ -1679,7 +1679,14 @@
/*************************************************************************
flP2H/2
*************************************************************************/
-flP2H(PrologTerm,HiLogTerm) :- plg2hlg(PrologTerm,HiLogTerm,WRAP_HILOG).
+flP2H(PrologTerm,HiLogTerm) :-
+ flora_plg2hlg(PrologTerm,HiLogTerm,WRAP_HILOG,P2H_UNIFY_VARS).
+
+%% This is used by the compiler for converting prolog to hilog
+%% in the implementation of @prologall().
+%% Note: flora_plg2hlg/4 succeeds if both arguments are unifiable prolog terms
+flora_post_p2h_conversion(PrologTerm,HiLogTerm) :-
+ flora_plg2hlg(PrologTerm,HiLogTerm,WRAP_HILOG,P2H_UNIFY_VARS).
/*************************************************************************
Index: flrutils.H
===================================================================
RCS file: /cvsroot/flora/flora2/flrutils.H,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- flrutils.H 25 May 2002 07:20:41 -0000 1.2
+++ flrutils.H 14 Jun 2002 09:05:32 -0000 1.3
@@ -112,7 +112,7 @@
flora_debug_code/2
from flrundefined.
-:- import plg2hlg/3 from prolog2hilog.
+:- import flora_plg2hlg/4 from prolog2hilog.
:- import flora_configuration/2,
flora_storage_registry/1,
@@ -173,6 +173,7 @@
flora_load_module_internal/1,
flora_load_module_internal/2,
flP2H/2,
+ flora_post_p2h_conversion/2,
flDump/1,
flora_locate_file/3,
flora_FLH_filename/2,
Index: flrshell.H
===================================================================
RCS file: /cvsroot/flora/flora2/flrshell.H,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- flrshell.H 18 May 2002 17:43:26 -0000 1.1.1.1
+++ flrshell.H 14 Jun 2002 09:05:32 -0000 1.2
@@ -49,6 +49,9 @@
flora_module_path_remove/1
from flrporting.
+:- import flora_plg2hlg/4 from prolog2hilog.
+:- import flora_post_p2h_conversion/2 from flrutils.
+
:- import pop_stdin/1 from push_io.
:- import
Index: flrprolog.P
===================================================================
RCS file: /cvsroot/flora/flora2/flrprolog.P,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- flrprolog.P 18 May 2002 17:43:26 -0000 1.1.1.1
+++ flrprolog.P 14 Jun 2002 09:05:32 -0000 1.2
@@ -54,6 +54,9 @@
flora_prlg(FL_RIGHTTO,2) :- !.
flora_prlg(FL_LEFTTO,2) :- !.
+flora_prlg(FL_COMMA,2) :- !.
+flora_prlg(FL_SEMICOLON,2) :- !.
+
flora_prlg(FL_PLUS,2) :- !.
flora_prlg(FL_MINUS,2) :- !.
flora_prlg(FL_SYMOR,2) :- !.
Index: flrporting.P
===================================================================
RCS file: /cvsroot/flora/flora2/flrporting.P,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- flrporting.P 10 Jun 2002 02:15:36 -0000 1.10
+++ flrporting.P 14 Jun 2002 09:05:32 -0000 1.11
@@ -157,6 +157,7 @@
flora_write_quoted_atom(Atom) :-
stat_flag(CURRENT_OUTPUT, StdOut),
file_writequoted(StdOut,Atom).
+%% Unquoted atom
flora_write_atom(Atom) :-
stat_flag(CURRENT_OUTPUT, StdOut),
file_puttoken(StdOut,TK_ATOM,Atom).
Index: flrparser.P
===================================================================
RCS file: /cvsroot/flora/flora2/flrparser.P,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- flrparser.P 10 Jun 2002 02:15:36 -0000 1.4
+++ flrparser.P 14 Jun 2002 09:05:32 -0000 1.5
@@ -485,7 +485,7 @@
is_flstring_struct(FLSTRING(_Str,_I)).
get_flvar_struct(OBJECT(VARIABLE(Name),I),FLVAR(Name,I)).
-is_flvar_struct(FLVAR(_Name,_I)).
+%%is_flvar_struct(FLVAR(_Name,_I)).
is_anonymous_flvar_struct(FLVAR(FL_UNDERSCORE,_I)).
fllist_struct(L,T,Index,FLLIST(L,T,Index)).
@@ -555,7 +555,6 @@
flpliball_struct(Goal,FLPLIBALL(Goal)) :- !.
%% Given module spec, get back module type and module name
-get_module_from_spec(FLORAUSERMOD(FL_THISMODULE),FLORAUSERMOD,FL_THISMODULE) :- !.
get_module_from_spec(FLORAUSERMOD(Mod),FLORAUSERMOD,Mod) :- !.
get_module_from_spec(FLORASYSMOD(Mod),FLORASYSMOD,Mod) :- !.
get_module_from_spec(PROLOGMODULE(Mod),PROLOGMODULE,Mod) :- !.
@@ -1430,6 +1429,13 @@
flora_workspace(R,RCode,S),
(S == [] -> flora_body(L,RCode,Code,Status); Status=S).
+%% reify op ${...} that occurs as a formula
+flora_body(CANOTERM(Funct,1,FL_BRACE,[Arg],_If,_Ip),_WS,Code,Status) :-
+ get_atom(Funct,Atom),
+ is_reifyop(Atom),
+ !,
+ flora_body(Arg,Code,Status).
+
%% At this point, CanoniTerm is not a logical formula.
flora_body(CANOTERM(Funct,1,FL_PARENTHESIS,Args,If,Ip),WS,Code,Status) :-
get_name(Funct,FL_IF),
@@ -1553,14 +1559,15 @@
!.
%% Handle THIS MODULE specification, e.g., a[b->c]@ _@.
-flora_workspace(CanoniTerm,FLORAUSERMOD(FL_THISMODULE),[]) :-
+flora_workspace(CanoniTerm,FLORAUSERMOD(ThisModToken),[]) :-
%% When _@ is specified as a module, we treat it
%% syntactically as FLORAUSERMOD because it is an atom
%% and not flora(...). However, this gets substituted with
%% FLORA_THIS_MODULE_NAME, so at compile time we get the right
%% module even if the current module was a system module
get_spectoken(CanoniTerm,FL_THISMODULE),
- !.
+ !,
+ flobject_struct(CanoniTerm,ThisModToken).
%% Handle a Prolog module. (@ prolog())
flora_workspace(CANOTERM(Mod,0,FL_PARENTHESIS,[],_Ifu,_Ipa),PROLOGMODULE,[]) :-
@@ -2001,10 +2008,9 @@
!,
parsing_error(I,NO_WORKSPACE,Status).
-flora_body_wsliteral(CanoniTerm,_Code,Status) :-
- get_flvar_struct(CanoniTerm,_V),
- !,
- parsing_error(CanoniTerm,NO_WORKSPACE,Status).
+flora_body_wsliteral(CanoniTerm,Code,[]) :-
+ get_flvar_struct(CanoniTerm,Code),
+ !.
flora_body_wsliteral(CanoniTerm,_Code,Status) :-
parsing_error(CanoniTerm,ERROR_BDLITERAL,Status).
@@ -2077,6 +2083,10 @@
),
!.
+thismodule_token(CanoniTerm,ThisModToken) :-
+ get_spectoken(CanoniTerm,FL_THISMODULE),
+ flobject_struct(CanoniTerm,ThisModToken).
+
/****************************************************************************
flora_constraint_list(+L,-Code,-Status)
@@ -2327,7 +2337,6 @@
%% Define which type of arguemnts should not have module specification.
nowspathexp(S) :- is_fllist_struct(S), !.
-nowspathexp(S) :- is_flvar_struct(S), !.
nowspathexp(S) :- is_flaggregt_struct(S), !.
nowspathexp(S) :- is_flreify_struct(S), !.
nowspathexp(S) :- is_flnumber_struct(S), !.
@@ -2862,12 +2871,14 @@
/****************************************************************************
flora_dbliteral(+Mode,+CanoniTerm,-CodeList,-Status)
- Note: Module name are allowed in insert/delete literals.
+ Note: Module names are allowed in insert/delete literals.
****************************************************************************/
flora_dbliteral(Mode,CANOTERM(Funct,2,FL_PARENTHESIS,[L,R],_If,_Ip),CodeList,Status) :-
get_atom(Funct,FL_AT),
!,
- ( flora_name_or_normvar(R,RCode) ->
+ %% Regular module name, Var, or special token _@
+ ( (flora_name_or_normvar(R,RCode) ; thismodule_token(R,RCode))
+ ->
flora_comma_separated_list(L,LList),
flora_dbwsliteral_list(Mode,LList,RCode,CodeList,Status)
@@ -2905,7 +2916,9 @@
get_atom(Funct,FL_AT),
!,
%% nested module name
- ( flora_name_or_normvar(R,RCode) ->
+ %% Regular module name, Var, or special token _@
+ ( (flora_name_or_normvar(R,RCode) ; thismodule_token(R,RCode))
+ ->
flora_comma_separated_list(L,LList),
flora_dbwsliteral_list(Mode,LList,RCode,CodeList,Status)
@@ -3097,11 +3110,6 @@
flora_db_pathexplist(Mode,Args,[LCode,RCode],Status),
(Status == [] -> flobjeql_struct(LCode,RCode,Code); true).
-/*
-flora_dbwslit(_Mode,CanoniTerm,_Code,Status) :-
- flora_check_update_ifthenelse(CanoniTerm,Status),
- !.
-*/
flora_dbwslit(Mode,CANOTERM(Funct,N,FL_PARENTHESIS,Args,If,_Ip),Code,Status) :-
!,
@@ -3229,7 +3237,8 @@
flora_db_pathexp(Mode,CANOTERM(Funct,2,FL_PARENTHESIS,[L,R],If,_Ip),Code,Status) :-
get_atom(Funct,FL_AT),
!,
- ( flora_name_or_normvar(R,RCode) ->
+ ( (flora_name_or_normvar(R,RCode) ; thismodule_token(R,RCode))
+ ->
flora_db_pathexp(Mode,L,LCode,S),
( S == [] ->
( is_flworkspace_struct(LCode) ->
Index: flrlexer.P
===================================================================
RCS file: /cvsroot/flora/flora2/flrlexer.P,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- flrlexer.P 18 May 2002 17:43:26 -0000 1.1.1.1
+++ flrlexer.P 14 Jun 2002 09:05:32 -0000 1.2
@@ -147,19 +147,24 @@
text_info(LN1,CN1,LN2,CN2,TextStr,Text),
atom_codes(A,TextStr).
+/***************************************************************************
+ Special tokens: numbered and unnumbered anon oids, _@
+****************************************************************************/
+%% _#, _@
flora_special_token_struct(TextStr,LN1,CN1,LN2,CN2,SPECIAL_TOKEN(A,Text)) :-
text_info(LN1,CN1,LN2,CN2,TextStr,Text),
atom_codes(A,TextStr).
-/***************************************************************************
- support for numbered anon oids
-****************************************************************************/
+%% _#N
flora_special_token_struct(TextStr,Num,LN1,CN1,LN2,CN2,SPECIAL_TOKEN(A,B,Text)) :-
TextStr=[Underscore, Hash],
text_info(LN1,CN1,LN2,CN2,[Underscore|[Hash|Num]],Text),
atom_codes(A,TextStr),
atom_codes(B,Num).
+/***************************************************************************
+ whitespace
+****************************************************************************/
flora_whitespace_struct(TextStr,LN1,CN1,LN2,CN2,WHITESPACE(Text)) :-
text_info(LN1,CN1,LN2,CN2,TextStr,Text).
Index: flrdependency.P
===================================================================
RCS file: /cvsroot/flora/flora2/flrdependency.P,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- flrdependency.P 2 Jun 2002 18:51:00 -0000 1.2
+++ flrdependency.P 14 Jun 2002 09:05:32 -0000 1.3
@@ -556,6 +556,11 @@
is_prnewoid(Term,Oid,Index),
!.
+build_struct(Term,VarList,Code,Spec) :-
+ is_prreify(Term,Term1),
+ !,
+ build_struct(Term1,VarList,Code,Spec).
+
build_struct(Term,VarList,Code,(CodeInd,Index)) :-
is_flogic(Term,F,N,Args),
!,
@@ -727,6 +732,13 @@
PF=WRAP_HILOG,
is_prlist(PArgs,[FObj|ObjList],[],_)
)
+
+ %% Case of X@Y, where X is a variable
+ ; is_prvariable(P,_VarName,_Index) ->
+ ModeArg=[],
+ PArgs = P,
+ PF=WRAP_HILOG
+
;
ModeArg=[],
is_flogic(P,PF,Arity,ObjList),
Index: flrdependency.H
===================================================================
RCS file: /cvsroot/flora/flora2/flrdependency.H,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- flrdependency.H 18 May 2002 17:43:26 -0000 1.1.1.1
+++ flrdependency.H 14 Jun 2002 09:05:32 -0000 1.2
@@ -47,6 +47,7 @@
is_prologliblit/4,
is_prnewpred/4,
is_prnewoid/3,
+ is_prreify/2,
is_flogic/4,
is_fllibdb/1
from flrcoder.
Index: flrcompiler.P
===================================================================
RCS file: /cvsroot/flora/flora2/flrcompiler.P,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- flrcompiler.P 2 Jun 2002 18:51:00 -0000 1.5
+++ flrcompiler.P 14 Jun 2002 09:05:32 -0000 1.6
@@ -94,8 +94,13 @@
is_flplib(FLPLIB(P,M),P,M).
is_flplib(FLPLIB(P),P).
%% @prologall() and @prologall(module)
-is_flpliball(FLPLIBALL(P),P).
-is_flpliball(FLPLIBALL(P,M),P,M).
+%% Make sure the coder translates flora_plg2hlg/4 as prolog
+is_flpliball(FLPLIBALL(P),P) :-
+ flora_define_prolog(flora_plg2hlg,4),
+ flora_define_prolog(flora_post_p2h_conversion,2).
+is_flpliball(FLPLIBALL(P,M),P,M) :-
+ flora_define_prolog(flora_plg2hlg,4),
+ flora_define_prolog(flora_post_p2h_conversion,2).
is_flifthenelse(FLIFTHENELSE(Cond,Then,Else),Cond,Then,Else).
is_flifthen(FLIFTHEN(Cond,Then),Cond,Then).
@@ -219,6 +224,8 @@
query_struct(Goal,PRQUERY(Goal)).
directive_struct(Direct,PRDIRECTIVE(Direct)).
+reify_struct(Formula,PRREIFY(Formula)).
+
command_struct(C,PRCOMMAND(C)).
table_struct(F,N,PRTABLE(F,N)).
%% We keep the import directive's support mechanism for @prolog(module)
@@ -315,30 +322,60 @@
termlit_struct(FObj,N,ObjList,PRTERMLIT(FObj,N,ObjList)).
workspacelit_struct(P,WS,Code) :-
- ( is_flatom(WS,WSAtom,Index) ->
- atomobj_struct(WSAtom,Index,WSCode),
- workspace_struct(P,WSCode,Code)
-
- ; is_flvar(WS,WSVarName,Index) ->
+ (is_flvar(WS,WSVarName,Index) ->
varobj_struct(WSVarName,Index,WSVarCode),
%% a call to a Flora user module
florasyslib_struct(FLLIBMODLIT,2,[P,WSVarCode],Code)
+
+ %% X@module of X@flora(module)
+ ; is_varobj_struct(P) ->
+ (is_flatom(WS,WSAtom,Index) -> atomobj_struct(WSAtom,Index,WSCode)
+ %% ...@ _@
+ ; is_fltoken(WS,FL_THISMODULE,_) -> thismodule_struct(WSCode)
+ ; WSCode = WS % if system module then it is already compiled
+ ),
+ %% a call to a module
+ florasyslib_struct(FLLIBMODLIT,2,[P,WSCode],Code)
+
+ ; is_flatom(WS,WSAtom,Index) ->
+ atomobj_struct(WSAtom,Index,WSCode),
+ workspace_struct(P,WSCode,Code)
+
+ ; is_fltoken(WS,FL_THISMODULE,_) ->
+ thismodule_struct(WSCode),
+ workspace_struct(P,WSCode,Code)
;
- %% a Flora system module
- workspace_struct(P,WS,Code)
+ %% a Flora system module
+ workspace_struct(P,WS,Code)
).
workspaceobj_struct(P,WS,Object,Code) :-
- ( is_flatom(WS,WSAtom,Index) ->
- atomobj_struct(WSAtom,Index,WSCode),
- Code=NULL,
- workspace_struct(P,WSCode,Object)
-
- ; is_flvar(WS,WSVarName,Index) ->
+ (is_flvar(WS,WSVarName,Index) ->
varobj_struct(WSVarName,Index,WSVarCode),
new_varobj(Index,Object),
- %% a call to a Flora user module
+ %% code to construct the object for foo@X in arg position,
+ %% i.e., p(foo@X)
florasyslib_struct(FLLIBMODOBJ,3,[P,WSVarCode,Object],Code)
+
+ ; is_varobj_struct(P) ->
+ (is_flatom(WS,WSAtom,Index) -> atomobj_struct(WSAtom,Index,WSCode)
+ ; is_fltoken(WS,FL_THISMODULE,_) -> thismodule_struct(WSCode)
+ ; WSCode = WS % if system module then it is already compiled
+ ),
+ new_varobj(Index,Object),
+ %% code to construct the object for X@... in arg position,
+ %% i.e., p(X@...)
+ florasyslib_struct(FLLIBMODOBJ,3,[P,WSCode,Object],Code)
+
+ ; is_flatom(WS,WSAtom,Index) ->
+ atomobj_struct(WSAtom,Index,WSCode),
+ workspace_struct(P,WSCode,Object),
+ Code=NULL
+
+ ; is_fltoken(WS,FL_THISMODULE,_) ->
+ thismodule_struct(WSCode),
+ workspace_struct(P,WSCode,Object),
+ Code=NULL
;
%% a Flora system module
Code=NULL,
@@ -1647,7 +1684,7 @@
( is_flatom(ParserTerm,_A) ->
atomobj_struct(ParserTerm,Object)
- ; is_fltoken(ParserTerm,FL_THISMODULE,Index) ->
+ ; is_fltoken(ParserTerm,FL_THISMODULE,_Index) ->
thismodule_struct(Object)
; is_flnumber(ParserTerm,_N) ->
@@ -1748,7 +1785,8 @@
%% because we are compiling a meta here, the code
%% is self-contained -- no oid part will be pushed
%% to the front of the enveloping term
- compile_body(T,TCode,S),
+ compile_body(T,TCode1,S),
+ reify_struct(TCode1,TCode),
( S == [] ->
compile_argpathexplist(L,ArgTypeList,LObj,OidCode,Code,Status)
;
@@ -2359,7 +2397,8 @@
compile_head_argpathexplist([T|L],[FL_BODYFORMULA|ArgTypeList],[TCode|LObj],Code,Status) :-
!,
- compile_body(T,TCode,S),
+ compile_body(T,TCode1,S),
+ reify_struct(TCode1,TCode),
( S == [] ->
compile_head_argpathexplist(L,ArgTypeList,LObj,Code,Status)
;
@@ -2647,6 +2686,12 @@
( is_flterm(ParserTerm,Funct,N,Args) ->
compile_wstermlit(Funct,N,Args,WS,OidCode,WSCode,Status)
+ ; is_flvar(ParserTerm,VarName,Index) ->
+ compile_flvar(VarName,Index,VarCode),
+ workspacelit_struct(VarCode,WS,WSCode),
+ OidCode = NULL,
+ Status = []
+
; is_flbirelate(ParserTerm,ObjTerm1,RelType,ObjTerm2) ->
compile_wsflbirelate(ObjTerm1,RelType,ObjTerm2,WS,_Obj,OidCode,WSCode,Status)
@@ -2678,9 +2723,12 @@
compile_wspathexp(+ParserTerm,+Workspace,-Object,-OidCode,-Code,-Status)
****************************************************************************/
compile_wspathexp(ParserTerm,WS,Object,OidCode,Code,Status) :-
- ( atomlit_struct(ParserTerm,A) ->
- workspaceobj_struct(A,WS,Object,Code),
- OidCode=NULL,
+ ( %% pred(Term@...)
+ %% Note: We have have to create code to compute X@.... We put this
+ %% code in OidCode so that it would precede the code for pred(...)
+ atomlit_struct(ParserTerm,A) ->
+ workspaceobj_struct(A,WS,Object,OidCode),
+ Code=NULL,
Status=[]
; is_flterm(ParserTerm,Funct,N,Args) ->
@@ -2691,6 +2739,15 @@
; is_flobjspec(ParserTerm,ObjTerm,Spec) ->
compile_wsflobjspec(ObjTerm,Spec,WS,Object,OidCode,Code,Status)
+
+ %% pred(X@...)
+ %% Note: We have have to create code to compute X@..., so we put
+ %% this code in OidCode so that it would precede the code for pred(...)
+ ; is_flvar(ParserTerm,VarName,VarIndex) ->
+ compile_flvar(VarName,VarIndex,VarCode),
+ workspaceobj_struct(VarCode,WS,Object,OidCode),
+ Code=NULL,
+ Status = []
;
is_flobjref(ParserTerm,ObjTerm,RefType,AttTerm),
compile_wsflobjref(ObjTerm,RefType,AttTerm,WS,Object,OidCode,Code,Status)
@@ -2738,7 +2795,8 @@
compile_wsflargpathexplist([T|L],[FL_BODYFORMULA|ArgTypeList],WS,[TCode|LObj],OidCode,Code,Status) :-
!,
%% workspace not distributive over nested "meta"
- compile_body(T,TCode,S),
+ compile_body(T,TCode1,S),
+ reify_struct(TCode1,TCode),
( S == [] ->
compile_wsflargpathexplist(L,ArgTypeList,WS,LObj,OidCode,Code,Status)
;
@@ -3179,7 +3237,8 @@
Compiling ${...}
****************************************************************************/
compile_reifyop(Formula,Object,Status) :-
- compile_body(Formula,Object,Status).
+ compile_body(Formula,Object1,Status),
+ reify_struct(Object1,Object).
/****************************************************************************
@@ -3397,8 +3456,13 @@
generate_convert_to_prolog_code([AObjH|AObjT],[AType|ATypes],[VarH|VarT],Code) :-
(AType==FL_BODYFORMULA
+ %% Don't convert meta arguments -- doesn't make sense
-> atomobj_struct('=',EqAtom),
termlit_struct(EqAtom,2,[AObjH,VarH],CodeH)
+ ; atomobj_struct(flora_plg2hlg,FlP2H),
+ %% P2H_DONOT_UNIFY_VARS - do not unify when both args are vars
+ termlit_struct(FlP2H,4,[VarH,AObjH,WRAP_HILOG,P2H_DONOT_UNIFY_VARS],CodeH)
+ /*
; atomobj_struct(var,VarAtom),
termlit_struct(VarAtom,1,[AObjH],VarTerm),
cut_struct(NO_INDEX, Cut),
@@ -3406,6 +3470,7 @@
termlit_struct(FlP2H,2,[VarH,AObjH],FlP2HTerm),
conjunct_struct(VarTerm,Cut,Code1),
disjunct_struct(Code1,FlP2HTerm,CodeH)
+ */
),
generate_convert_to_prolog_code(AObjT,ATypes,VarT,CodeT),
conjunct_code([CodeH,CodeT],Code).
@@ -3419,6 +3484,10 @@
(AType==FL_BODYFORMULA
-> atomobj_struct('=',EqAtom),
termlit_struct(EqAtom,2,[AObjH,VarH],CodeH)
+ ; atomobj_struct(flora_post_p2h_conversion,FlP2H),
+ %% P2H_UNIFY_VARS - unify when both args are vars
+ termlit_struct(FlP2H,2,[VarH,AObjH],CodeH)
+ /*
; atomobj_struct(nonvar,NonvarAtom),
termlit_struct(NonvarAtom,1,[AObjH],NonvarTerm),
cut_struct(NO_INDEX, Cut),
@@ -3426,6 +3495,7 @@
termlit_struct(FlP2H,2,[VarH,AObjH],FlP2HTerm),
conjunct_struct(NonvarTerm,Cut,Code1),
disjunct_struct(Code1,FlP2HTerm,CodeH)
+ */
),
generate_convert_from_prolog_code(AObjT,ATypes,VarT,CodeT),
conjunct_code([CodeH,CodeT],Code).
@@ -3498,8 +3568,9 @@
compile_head_wsflargpathexplist([T|L],[FL_BODYFORMULA|ArgTypeList],WS,
[TCode|LObj],Code,Status) :-
!,
- %% workspace not distributive over nested "form"
- compile_body(T,TCode,S),
+ %% workspace not distributive over nested `meta' argument spec
+ compile_body(T,TCode1,S),
+ reify_struct(TCode1,TCode),
( S == [] ->
compile_head_wsflargpathexplist(L,ArgTypeList,WS,LObj,Code,Status)
;
Index: flrcoder.P
===================================================================
RCS file: /cvsroot/flora/flora2/flrcoder.P,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- flrcoder.P 2 Jun 2002 18:51:00 -0000 1.2
+++ flrcoder.P 14 Jun 2002 09:05:33 -0000 1.3
@@ -52,6 +52,8 @@
is_prquery(PRQUERY(Goal),Goal).
is_prdirective(PRDIRECTIVE(Direct),Direct).
+is_prreify(PRREIFY(Formula),Formula).
+
is_prcommand(PRCOMMAND(C),C).
is_prtable(PRTABLE(P,A),P,A).
is_primport(PRIMPORT(P,A,M),P,A,M).
@@ -61,9 +63,10 @@
is_prconstraint(PRCONSTRAINT(Constr),Constr).
is_prthismodule(PRTHISMODULE(PRTHISMODULE)).
-is_prthisfdbstorage(PRTHISFDBSTORAGE(PRTHISFDBSTORAGE)).
+is_prthisfdbstorage(PRTHISFDBSTORAGE(PRTHISFDBSTORAGE)) :- !.
+is_prthisfdbstorage(PRFDBSTORAGE(Spec)) :- is_prthismodule(Spec).
%% debug trie
-is_prthisfldstorage(PRTHISFLDSTORAGE(PRTHISFLDSTORAGE)).
+is_prthisfldstorage(PRTHISFLDSTORAGE(PRTHISFLDSTORAGE)) :- !.
%% with textual information
is_pratom(PRATOM(Atom,I),Atom,I).
@@ -96,7 +99,7 @@
is_prworkspace(PRWORKSPACE(P,WS),P,WS).
%% with textual information
-is_prfloralib(PRFLORALIB(PRATOM(WS,_I)),WS).
+is_prfloralib(PRFLORALIB(PRATOM(WS,I)),WS,I).
is_florasyslib(FLORASYSLIB(I,F,N,Args),F,N,Args,I).
is_prologterm(PROLOGTERM(F,N,Args),F,N,Args).
@@ -453,8 +456,9 @@
( is_pratom(WS,WSAtom,_Index) ->
%% a user module name
flora_write_wsstruct(WSAtom,P,Prefix)
+
;
- %% a Flora system module name
+ %% a Flora system module or this-module-spec
flora_write_wsstruct(WS,P,Prefix)
).
@@ -464,6 +468,14 @@
flora_write_newpred(F,N,Args,Prefix).
flora_write_struct(Term,_Prefix) :-
+ is_prreify(Term,Term1),
+ !,
+ flora_get_counter(using_debug_prefix,OldDbgPref),
+ flora_set_counter(using_debug_prefix,1),
+ flora_write_struct(Term1,FLBODYPREFIX),
+ flora_set_counter(using_debug_prefix,OldDbgPref).
+
+flora_write_struct(Term,_Prefix) :-
is_prnewoid(Term,Oid,_Index),
!,
flora_write_newoid(Oid).
@@ -491,6 +503,13 @@
!,
flora_write_syslib(F,N,Args,Prefix).
+%% This is used when calling X@flora(...)
+flora_write_struct(Term,Prefix) :-
+ is_prfloralib(Term,Atom,Index),
+ !,
+ is_pratom(AtomStruct,Atom,Index),
+ flora_write_prolog(FL_FLORALIB,1,[AtomStruct],Prefix).
+
flora_write_struct(Term,Prefix) :-
is_skolem(Term,F,N,Args,_Index),
!,
@@ -499,25 +518,28 @@
flora_write_struct(Term,_Prefix) :-
is_prthismodule(Term),
!,
- %% The module name is not encoded.
+ %% Atom is not quoted when written.
flora_write_atom('FLORA_THIS_MODULE_NAME').
flora_write_struct(Term,_Prefix) :-
is_prthisfdbstorage(Term),
!,
%% This is an encoded storage name.
+ %% Atom is not quoted when written.
flora_write_atom('FLORA_THIS_FDB_STORAGE').
flora_write_struct(Term,_Prefix) :-
is_prthisfldstorage(Term),
!,
%% This is an encoded storage name.
+ %% Atom is not quoted when written.
flora_write_atom('FLORA_THIS_FLD_STORAGE').
flora_write_struct(Term,_Prefix) :-
is_prfdbstorage(Term,WSName,_Index),
!,
%% This refers to a Flora user module storage.
+ %% Atom is not quoted when written.
flora_write_atom('FLORA_USER_FDB_STORAGE('),
flora_write_functor(WSName),
put(0')).
@@ -625,10 +647,14 @@
by the compiler.
****************************************************************************/
flora_write_wsstruct(WS,Term,Prefix) :-
- ( is_prfloralib(WS,WSAtom) ->
+ ( is_prfloralib(WS,WSAtom,_) ->
%% a call to Flora system module
flora_write_sysmod(WSAtom,Term,Prefix)
+ %% If this module, then use the method for writing with THIS workspace
+ ; is_prthismodule(WS) ->
+ flora_write_struct(Term,Prefix)
+
; is_pratomlit(Term,Atom,_Index) ->
flora_write_atomlit(USERMODULE,WS,Atom,Prefix)
@@ -726,22 +752,23 @@
flora_write_workspace(THISMODULE,_WS,Funct) :-
!,
%% _WS is a just a place holder.
+ %% Atom is not quoted when written.
flora_write_atom('FLORA_THIS_WORKSPACE('),
flora_write_functor(Funct),
put(0')).
flora_write_workspace(USERMODULE,WS,Funct) :-
!,
+ %% Atom is not quoted when written.
flora_write_atom('FLORA_USER_WORKSPACE('),
- (WS == FL_THISMODULE -> write('FLORA_THIS_MODULE_NAME')
- ; flora_write_functor(WS)
- ),
+ flora_write_functor(WS),
put(0',),
flora_write_functor(Funct),
put(0')).
flora_write_workspace(SYSTEMMODULE,WS,Funct) :-
!,
+ %% Atom is not quoted when written.
flora_write_atom('FLORA_SYSTEM_WORKSPACE('),
flora_write_functor(WS),
put(0',),
@@ -911,6 +938,13 @@
PF=WRAP_HILOG,
is_prlist(PArgs,[FObj|ObjList],[],_I)
)
+
+ %% Case of X@Y, where X is a variable
+ ; is_prvariable(P,_VarName,_Index) ->
+ ModeArg=[],
+ PArgs = P,
+ PF=FL_LIBMOD % this wrapper is ignored -- just a placeholder
+
;
ModeArg=[],
is_flogic(P,Wrap,Arity,ObjList),
@@ -1070,6 +1104,11 @@
is_prstring(Term,Code,_Index),
!.
+flora_build_struct(Term,_DWS,_Prefix,_VarList,FLORA_DEFAULT_WORKSPACE) :-
+ is_prthismodule(Term),
+ !.
+
+
flora_build_struct(Term,DWS,Prefix,VarList,Code) :-
is_prlist(Term,L,T,_Index),
!,
@@ -1133,6 +1172,7 @@
( is_pratom(WS,WSAtom,_Index) ->
%% a user module name
flora_build_wsstruct(P,WSAtom,DWS,Prefix,VarList,Code)
+
;
%% a Flora system module name
flora_build_wsstruct(P,WS,DWS,Prefix,VarList,Code)
@@ -1143,6 +1183,14 @@
!,
flora_build_newpred(F,N,Args,DWS,Prefix,VarList,Code).
+flora_build_struct(Term,DWS,_Prefix,VarList,Code) :-
+ is_prreify(Term,Term1),
+ !,
+ flora_get_counter(using_debug_prefix,OldDbgPref),
+ flora_set_counter(using_debug_prefix,1),
+ flora_build_struct(Term1,DWS,FLBODYPREFIX,VarList,Code),
+ flora_set_counter(using_debug_prefix,OldDbgPref).
+
flora_build_struct(Term,DWS,Prefix,VarList,Code) :-
is_flogic(Term,F,N,Args),
!,
@@ -1170,6 +1218,13 @@
!,
flora_build_syslib(F,N,Args,DWS,Prefix,VarList,Code).
+%% This is used when calling X@flora(...)
+flora_build_struct(Term,DWS,Prefix,VarList,Code) :-
+ is_prfloralib(Term,Atom,Index),
+ !,
+ is_pratom(AtomStruct,Atom,Index),
+ flora_build_prolog(FL_FLORALIB,1,[AtomStruct],DWS,Prefix,VarList,Code).
+
flora_build_struct(Term,DWS,Prefix,VarList,Code) :-
is_skolem(Term,F,N,Args,_Index),
!,
@@ -1193,11 +1248,6 @@
flora_user_module_predicate_symbol(WRAP_HILOG,DWS,NewP),
Code=table(NewP/N).
-%%flora_build_struct(Term,DWS,_Prefix,_VarList,Code) :-
-%% is_prdynamic(Term,P,A),
-%% !,
-%% flora_build_predicate_symbol(P,A,DWS,NewP),
-%% Code=dynamic(NewP/A).
flora_build_struct(Term,DWS,_Prefix,_VarList,Code) :-
is_prindex(Term,P,A,N),
@@ -1270,9 +1320,13 @@
flora_build_wsstruct(+Term,+Workspace,+DefaultWorkspace,+Prefix,?VarList,-Code)
****************************************************************************/
flora_build_wsstruct(Term,WS,DWS,Prefix,VarList,Code) :-
- ( is_prfloralib(WS,WSAtom) ->
+ ( is_prfloralib(WS,WSAtom,_) ->
flora_build_sysmod(Term,WSAtom,DWS,Prefix,VarList,Code)
+ %% If this module, then use the method for writing with THIS workspace
+ ; is_prthismodule(WS) ->
+ flora_build_struct(Term,DWS,Prefix,VarList,Code)
+
; is_pratomlit(Term,Atom,_Index) ->
flora_build_atomlit(USERMODULE,Atom,WS,Prefix,Code)
@@ -1312,12 +1366,7 @@
flora_build_wsliteral(Mode,F,_N,Args,WS,DWS,Prefix,VarList,Code) :-
flora_build_structlist(Args,DWS,Prefix,VarList,ACodeList),
( Mode == USERMODULE ->
- (WS == FL_THISMODULE
- %% In the shell, THIS module can be only FLORA_DEFAULT_WORKSPACE
- -> NewWS = FLORA_DEFAULT_WORKSPACE
- ; NewWS = WS
- ),
- flora_user_module_predicate(F,ACodeList,NewWS,Code)
+ flora_user_module_predicate(F,ACodeList,WS,Code)
; Mode == SYSTEMMODULE ->
flora_system_module_predicate(F,ACodeList,WS,Code)
@@ -1442,6 +1491,14 @@
PF=WRAP_HILOG,
is_prlist(PArgs,[FObj|ObjList],[],_I)
)
+
+ %% Case of X@Y, where X is a variable
+ ; is_prvariable(P,_VarName,_Index) ->
+ ModeArg=[],
+ PArgs = P,
+ %% this particular wrapper is ignored in fllibmodlit/3
+ PF=FL_LIBMOD
+
;
ModeArg=[],
is_flogic(P,Wrap,Arity,ObjList),
Index: flrcoder.H
===================================================================
RCS file: /cvsroot/flora/flora2/flrcoder.H,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- flrcoder.H 18 May 2002 17:43:25 -0000 1.1.1.1
+++ flrcoder.H 14 Jun 2002 09:05:33 -0000 1.2
@@ -91,5 +91,6 @@
is_prologliblit/4,
is_prnewpred/4,
is_prnewoid/3,
+ is_prreify/2,
is_flogic/4,
is_fllibdb/1.
|
|
From: <ki...@us...> - 2002-06-14 09:05:36
|
Update of /cvsroot/flora/flora2/docs
In directory usw-pr-cvs1:/tmp/cvs-serv25757/docs
Modified Files:
technical.txt flora2.tex
Log Message:
1. Parser, compiler, coder: Allow things like X@..., where X is a variable
2. Compiler, coder: make sure that reified statements are encoded as body
literals even if they occur in the head.
Otherwise won't be able to match queries against facts.
3. Fixes in prologall() and prolog2hilog conversion. Seems to work correctly
now.
4. Changed syslib/flrmetaops.P and syslib/flrdynmod.P so that they'll work
with the richer X@... syntax.
Index: technical.txt
===================================================================
RCS file: /cvsroot/flora/flora2/docs/technical.txt,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- technical.txt 18 May 2002 17:43:28 -0000 1.1.1.1
+++ technical.txt 14 Jun 2002 09:05:32 -0000 1.2
@@ -115,3 +115,30 @@
ruleoid/2 relation is reset by the compiler at the beginning of each new
rule.
+3. Translation of @prologall()
+ p(X,Y)@prologall() becomes:
+
+ flora_plg2hilog(NewX,X,flapply,0), % don't unify vars
+ flora_plg2hilog(NewY,Y,flapply,0),
+ p(NewX,NewY),
+ flora_post_p2h_convertion(NewX,X), % unify vars
+ flora_post_p2h_convertion(NewY,Y)
+
+ This works because:
+
+ a. flora_plg2hilog(NewX,X,0) creates a new variable NewX and doesn't
+ unify it with X
+ b. p/2 is evaluated with respect to the new variables
+ c. The resulting bindings for NewX, NewY are converted to hilog and
+ unified with X,Y.
+ d. If X or Y are already prolog then NewX, NewY are unified as Prolog
+ predicates. This is because flora_post_p2h_convertion/2 is defined as
+
+ flora_post_p2h_convertion(PrologTerm,HiLogTerm) :-
+ (flora_plg2hlg(PrologTerm,HiLogTerm,WRAP_HILOG,P2H_UNIFY_VARS), !
+ ; PrologTerm = HiLogTerm
+ ).
+
+ In our situation, flora_plg2hlg/4 fails ONLY if HiLogTerm (i.e., X or Y)
+ were originally Prolog terms.
+
Index: flora2.tex
===================================================================
RCS file: /cvsroot/flora/flora2/docs/flora2.tex,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- flora2.tex 10 Jun 2002 02:17:05 -0000 1.8
+++ flora2.tex 14 Jun 2002 09:05:32 -0000 1.9
@@ -2457,12 +2457,20 @@
atomic formula {\tt a(b)}, and thus has no truth value. In fact, since
terms are not associated with any \FLORA module, it is not clear what $\tt
X(p)$ should mean when $\tt X$ is bound to a \emph{term} $\tt a(b)$ ({\it
- e.g.}, in what module should $\tt a(b)(p)$ be called). In a future
-release, we will provide a predicate {\tt call}/2, which would convert
-HiLog terms into HiLog predicates in a given module, so
-(\ref{eq-hilog-notallowed}) could be rewritten into {\tt p(X), X(p),
- call(X, \_@).} In this example, {\tt call(X, \_@)} would cause {\tt a(b)}
-to be executed in the current module.
+ e.g.}, in what module should $\tt a(b)(p)$ be called). However,
+the following query would work correctly:
+%%
+\begin{verbatim}
+ ?- p(X),X(p),X@foo.
+\end{verbatim}
+%%
+if we need to call {\tt X} in module {\tt foo}. If we need to call it in
+the current module, then we could use the following:
+%%
+\begin{verbatim}
+ ?- p(X),X(p),X@ _@.
+\end{verbatim}
+%%
@@ -2587,6 +2595,60 @@
molecules by binding {\tt X} to {\tt a}, {\tt M} to {\tt m}, and {\tt V} to
{\tt p}.
+Meta-unification is very useful when it is necessary to find out the module
+in which a particular formula lives. For instance,
+%%
+\begin{verbatim}
+ ?- X ~ a[b->c]@foo, X ~ Y@M.
+\end{verbatim}
+%%
+would bind {\tt Y} to {\tt X} and {\tt M} to the module of {\tt X}. Note that
+in meta-unification the variable {\tt Y} in the idiom \verb|Y@M| or
+\verb|Y@foo| is viewed as a meta-variable that is bound to a
+formula. Thus, in the above, {\tt Y} is bound to {\tt X}. More subtle
+examples are
+%%
+\begin{verbatim}
+ ?- X ~ f(a)@foo, X ~ Y@M.
+ ?- f(a)@foo ~ Y@M.
+\end{verbatim}
+%%
+In both cases {\tt M} is bound to {\tt foo} and {\tt Y} is bound to the
+(internal representation of the) HiLog formula {\tt f(a)@foo} ---
+\emph{not} to the HiLog term {\tt f(a)}!
+
+Another subtlety has to do with the scope of the module specification.
+In \FLORA, module specifications have scope and inner specifications
+override the outer ones. For instance, in
+%%
+\begin{verbatim}
+ ..., (abc@foo, cde)@bar, ...
+\end{verbatim}
+%%
+the term {\tt abc} is in module {\tt foo}, while {\tt cde} in module {\tt
+bar}. This is because the inner module specification, {\tt @foo}, overrides
+the outer specification {\tt @bar} for the literal in which it occurs ({\it
+i.e.}, {\tt abc}). These scoping rules have subtle impact on literals that
+are computed dynamically at run time. For instance, consider
+%%
+\begin{verbatim}
+ ?- X ~ a[b->c]@foo, X@bar.
+\end{verbatim}
+%%
+Because {\tt X} gets bound to {\tt a[b->c]@foo}, the literal {\tt X@bar}
+becomes the same as {\tt (a[b->c]@foo)@bar}, {\it i.e.}, {\tt a[b->c]@foo}.
+Thus, both of the following queries succeed:
+%%
+\begin{verbatim}
+ ?- X ~ a[b->c]@foo, X@bar ~ a[b->c]@foo.
+ ?- X ~ a[b->c]@foo, X@M ~ a[b->c]@foo.
+\end{verbatim}
+%%
+Moreover, in the second query, the variable {\tt M} is \emph{not} bound to
+anything because, as noted before, the literal {\tt X@M} becomes
+{\tt (a[b->c]@foo)@M)} at run time and, due to the scoping rules, is the
+same as {\tt a[b->c]@foo}.
+
\paragraph{Reification.}
\index{reification operator \$\{...\}}
\index{\$\{...\}!reification operator}
@@ -2697,31 +2759,45 @@
\begin{itemize}
\item {\tt Plg} is a Prolog term and {\tt Hlg} is its HiLog
representation.
-\item Both {\tt Plg} and {\tt Hlg} are identical HiLog terms.
+\item Both {\tt Plg} and {\tt Hlg} are identical Prolog terms.
\end{itemize}
%%
Note that if both {\tt Plg} and {\tt Hlg} are bound to the same
-\emph{Prolog term} then the predicate \emph{fails}. Thus, if you type the
+\emph{HiLog term} then the predicate \emph{fails}. Thus, if you type the
following queries into the \FLORA shell, they both succeed:
%%
{\tt
\begin{quote}
- ?- flP2H(X,f(a)), flP2H(X,f(a)). \\
+ ?- flP2H(X,f(a)), flP2H(X,X). \\
?- flP2H(f(a),f(a)).
\end{quote}
}
%%
+but the following will fail:
+%%
+\begin{verbatim}
+ ?- flP2H(f(a),X), flP2H(X,X).
+\end{verbatim}
+%%
+
+We should note that you should not try to convert certain Prolog terms to
+HiLog and expect them to be the same as similarly looking \FLORA terms. In
+particular, this applies to reified statements. For instance, if {\tt X =
+\${a[b->c]}} then {\tt ?- flP2H(X,Y), Y = \${a[b->c]}} is not expected to
+succeed. This is because {\tt flP2H/2} does not attempt to mimic the \FLORA
+compiler in cases where conversion to HiLog (such as in case of reified
+statements) makes no sense. Doing so would have substantially increased the
+run-time overhead.
-%% Unimplemented -- useful libraries
Not all arguments passed back and forth to Prolog need conversion. For
instance, {\tt sort/2}, {\tt ground/1}, {\tt compound/1}, and many others
do not need conversion because they work the same for Prolog and HiLog
representations. On the other hand, most I/O predicates require conversion.
-In a future release, \FLORA will provide libraries of useful predicates and
-methods that do appropriate conversion without the user having to do
-this explicitly. One such library, {\tt io}, is described in
-Section~\ref{sec-service-libs}.
+\FLORA provides the {\tt io} library, described in
+Section~\ref{sec-service-libs}, which provides the needed conversions for
+the I/O predicates.
+
\index{@prologall()}
%%
@@ -3514,7 +3590,6 @@
\end{quote}
%%
which renders {\tt tc/2} as a tabled first-order predicate.
-({\bf Unimplemented}: In the future, the tabling directive will imply {\tt firstorder}.)
\index{hilogtable}
\index{compiler directive!{\tt hilogtable}}
|