Typol side

The first step to establishing communication between a Typol program and the Le-Lisp environment is to export a proposition that you wish to make, i.e., trigger from the Le-Lisp world. The Typol compiler generates Le-Lisp function associated with every exported Typol proposition. The function's arguments are the initial values of the proposition. The function takes care of coercing these values to prolog terms.

The export command has the syntax:


   export <premises> as 
          <function-name> (<val1>, <val2>, ...) = <result> ;

where <function-name> will be the (unpackaged) name of the generated function, <val1>, <val2>, ... its arguments, and <result> its result. The arguments and result correspond to variable names in the premises of <premises>, which is an axiom or the denominator of a rule. It is also possible to return several results in a list, using the syntax:


   export <premises> as 
          <function-name> (<val1>, <val2>, ...) = 
                          (<result1>, <result2>, ...) ;

Since our interrogations in Exp have the form:


    |- exp : integer N;

our export clause is:


    export |- exp : integer N as eval_exp(exp) = N;

The generated function eval_exp takes one argument, a tree, which will become the value of the Typol variable exp before Typol tries to prove the proposition |- exp : integer N. The result of the proof, named N in Typol, will be returned by the function eval_exp.

The above description is only partially accurate because the name of any Le-Lisp function generated by the compilation of an export statement has the following syntax:

#:program_name:function_name

so that in our example, the full generated function name would be
#:eval_exp:eval_exp.

N.B. You should not call a function generated by an export clause directly but use either the ty-synchronous-run function for batch mode executions (for example, to quickly test a Typol program) or an interactive environment as described in section .


Tutorial