We consider an example showing in which way structures are represented
in the Classified Clauses. The first step we show is the flattening
and normalizing that precedes (as part of the horizon command, cf. section
compilation before classified clauses are generated (see [Kra91]
and section 2).
bar(R,S). fie(f[b],f[b],b) :- W is g[f[b]] & bar(b,W).
Leads after flattering and normalizing to:
bar(R,S). fie(_3,_3,b) :- _3 is f[b], W is g[_3] & bar(b,W).Lisp-like source:
(hn (bar _r _s)) (ft (fie _3 _3 b) (is _3 `(f b)) (is _w `(g _3)) (bar b _w) )
(db (proc bar/2 1 (indexing) ; no indexing (rel0 ; bar/2 is an hn-fact (cut-info nil) ; no cut (perm) ; No permanent variables (temp (_r (1 (1) nil)) ; 2 temporary variables (_s (2 (2) nil))) (chunk ((usrlit (bar (_r (first safe temp)) (_s (first safe temp))) (2 0 (1 2)) )); Proposed instructions for position 1 and nil))) ; 2, but the code generator will make it better ; Start of the description of the next procedure (proc fie/3 1 (indexing) ; no indexing (fun1eva ; A one-chunk rule with an evaluative foot (cut-info nil) (perm) (temp (_3 (1 (2 1) nil)) ; the variable _3 has no occurrence ; in the call_literal of its chunk (_w (2 nil (2)))) (chunk ((usrlit (fie (_3 (first safe temp)) (_3 (nonfirst safe temp)) b) ; A constant gets no further description (3 0 (3 1 2)) ) ; Generate code for the constant first! (is (_3 (nonfirst global temp)) `(f b)) ; A chunk guard gets no further description (is ; All is-primitives are used denotatively (_w (first unsafe temp)) ; in the Classified Clauses `(g (_3 (nonfirst safe temp))) ) ; The structure g/2 ; beginning with "`" (usrlit (bar b (_w (nonfirst unsafe temp))) (2 0 (1)))); No instruction for _w necessary because ; the register 2 is assigned to it (3 nil))))) ; lu_reg = 3, because of the literal foo/3