[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: several questions




[Our news/mail system seems to have troubles when sending followup to
user questions.  I apologize for the inconveniences. Thierry]

Path: almeria.inria.fr!td
Newsgroups: sophia.centaur
Distribution: world
Followup-To: 
References:  <51628@sophia.inria.fr>
From: td@almeria.inria.fr (Thierry Despeyroux)
Reply-To: Thierry.Despeyroux@sophia.inria.fr
Organization: INRIA, Sophia-Antipolis (Fr)
Subject: Re: several questions
Keywords: 

In article <51628@sophia.inria.fr>, jperez@lsi.upc.es (Javier Perez) writes:

|> I want to report what I think is a bug in TYPOL. I have made a program
|> in TYPOL that uses the recovery rules to implement a simple nagation.
|> 
|> The program runs OK when the module --------------  is loaded either
|> by calling {debug}:start or by compiling a TYPOL program.
|> 
|> But when this module is not loaded, when the program has to apply a
|> recovery rule it hangs. I have monitorized the load of the machine by
|> means of the xload program (widely known), and when the program
|> reaches the first recovery rule the load falls down until the machine
|> appears to be idle.

Yes, I have to look at this problem. If you want to execute this program in a 
no debug mode, you can use (#:debug:start), then press the "GO" button, or 
do the same thing automatically: if debug is a variable that is set to t when
you want to go in debug node, the following code will do it:

                (#:debug:start)
                (unless debug
                        (#:DEBUG_LOOP:I_U_GO)
                        (DEBUG_LOOP))


|> 2)
|> I suppose it is possible to call a TYPOL predicate from a prolog function,
|> I will like to know if this is safe to do, and how has to be done.

Yes it is safe, but of course you must know how prolog predicates are
generated by the Typol compiler.

1) the name of the predicates

examples:

program P is

judgement E |- A, B -> C;  --(1)
...

set S is
judgement FOO |- X : T;    --(2)
...
end;
end;

for (1) the name is 'P$1|-2->1'
for (2) the name is 'P$S$1|- 1:1'

explanation:
The name is built using the name of the program and the names of the sets
(a set may be included in an other one) followed by the judgement, but only
the graphical elements are kept and a list of expression is replaced by the
number of arguments in the list.

But if the judgement is only a list of arguments as in

judgement (A, B); --(3)

the number of arguments is omitted, giving  only 'P' or 'P$S'.
(This insure an easier compatibility with prolog preicates)

You can check the name that is generated in the produced code.

2) the arguments

There are in the same order in Typol and in Prolog.
If the judgement is only a list of arguments as in (3)
the number of parameters is the same in Typol and in Prolog
(again for compatibility with prolog).

In all other cases, there are 3 more parameters in the prolog generated code.
The first one is the subject, the second the path to the rule that call this
predicate, the third tells if error recovery must be enable or not.

The subject must be set to '$PSP$nil', unless you have a good reason to use
a valid subject path.
The caller must be set to '$PSP$nil', as it is not a Typol rule.
The last parameter must be set to _ (a free variable) if error recovery
is allowed or 'norecovery' if recovery is not allowed.

Examples:

'P$S$1|- 1:1'(Arg1, Arg2, Arg3, '$PSP$nil', '$PSP$nil', _)

'P$S'(Arg1, Arg2)


A good idea is to provide a judgement in the form (3), only to make the connexion with
prolog easier and to be sure that the code will still work if for some reason I decide
to change the way prolog code is generated. A simple rule will do it:
for example:
A |- B, C
---------
(A, B, C);

|> 3)
|> I have heard that Centaur 1.3 is about to be shipped, I will like to
|> know which is the ship date, and I would appreciate it if you can make
|> me a little summary of the improvements of this version on TYPOL.

I can't tell you when Centaur1.3 will be ready. The Typol system itself will remain
similar, except for some bugs that are fixed and some minor improvements (time of
transfert between Lisp and Prolog and possiblity to put Typol programs where
you want it for exemple).

There will be a new checker made by Isabelle Attali that will provide some
warnings concerning the style that is used in your rules. This is the first steptoward the possibility to compile Typol into Lisp or attributed grammars.
A new keyword (functional) will declare that in a judgement some parameters
must be instantiated before the call and others will be results.

Concerning the replacement of MU-Prolog by Sepia (now ECLiPSe) I think it will
come a bit latter for those who have enough courage to test the first version.
As ECLiPSe is a compiled prolog system with garbage collection far more flexiblethan MU-Prolog, I hope this will change the life of Typol users. The Typol
programs will be completely compatible, but the Lisp interface will have to be
rewritten.

Thierry.
-- 
Send contributions and compliments to centaur@sophia.inria.fr. Registration
and administrative matters should be sent to centaur-request@sophia.inria.fr.
+---------------------------------------------------------------------------+
|     Thierry Despeyroux      | email: Thierry.Despeyroux@sophia.inria.fr   |
| I.N.R.I.A. Sophia-Antipolis | phone: +33 93 65 77 07 fax: +33 93 65 77 66 |
+---------------------------------------------------------------------------+