Prolog code generation takes as argument the environment generated by the type-checker and produces Prolog clauses that are put as an annotation (pl_code) to the source specification. These clauses feed three requirements of the Typol implementation: a types data-base used by the Typol type-checker, dynamic type-checking and prolog to VTP conversion and dynamic type-checking.
Here is the Prolog code generated for the previous example:
%$lang(phylum) '$L'('Phy'). %$lang(operator,Lang::phylum) '$L'('f', '$TYPOL$l_id'('$TYPOL$id'('L'), '$TYPOL$id'('Phy'))). '$L'('id', '$TYPOL$l_id'('$TYPOL$id'('L'), '$TYPOL$id'('Phy'))). %$lang(operator, sons_type, name) '$L'( 'f', '$TYPOL$type_s'( '$TYPOL$l_id'('$TYPOL$id'('L'), '$TYPOL$id'('Phy')), '$TYPOL$type_s'('nil')), '$L$f'). '$L'('id', '$TYPOL$id'('string'), '$L$id'). %$lang$phylum(scheme) delay '$L$Phy'(_X) if 'var'(_X). '$L$Phy'('$L$f'(_)). '$L$Phy'('$L$id'(_)). %$lang$op(arity,lang,op) '$L$f'(1, 'L', 'f'). '$L$id'('string', 'L', 'id').