Lisp code generation takes as argument the environment generated by the type-checker. It produces a Lisp function ( #:L:formalism_create if L is the name of the formalism) that creates a VTP formalism. This function is put as an annotation ( LL_code) to the source specification. It first creates the formalism (formalism:make), empty phyla (phylum:make), and operators (operator:make). It then constructs the effective value of the phyla (phylum:insert), creates the ``meta'' operator then close the formalism (formalism:complete).
Here is the Lisp code generated for the previous example:
(defun #:L:formalism-create ()
(lets ((L-form ({formalism}:make 'L))
(Phy-phy ({phylum}:make 'Phy L-form))
(f-op ({operator}:make 'f L-form 1 Phy-phy))
(id-op ({operator}:make 'id L-form 0 {name})))
({phylum}:insert Phy-phy f-op)
({phylum}:insert Phy-phy id-op)
({formalism}:metavarop
L-form
({operator}:make 'meta L-form 0 {metavariable}))
(addop_meta L-form)
({formalism}:complete L-form)
L-form))
Notice that the Centaur VTP allows the use of a phylum belonging to a foreign formalism in the domain of an operator (formalism inclusion). As this was not the case in Mentor, such a formalism cannot be saved in a (.t) table. For the same reason, polish (.po) files cannot be used with AS defined formalisms.
Thierry Despeyroux