next up previous contents
Next: 4.5 Literal level and Up: 4 The classifier Previous: 4.3 Clause level

4.4 Chunk level


head_chunk_fact     		 ::= 		 (chunk (head_literal {chunk_guard}*) chunk_descr)

head_chunk_rule ::= (chunk (head_literal {chunk_guard}* first_premise_literal)


body_chunk_list ::= {body_chunk}* [(({chunk_guard}*) chunk_descr)]

body_chunk ::= (chunk ({chunk_guard}* call_literal) chunk_descr)

call_literal ::= literal_classification tex2html_wrap_inline2907 lispcall_classification

chunk_guard ::= builtin tex2html_wrap_inline2907 passive_term

chunk_descr ::= (lu_reg ({(variable permvar_uselit_list)}*))

permvar_uselit_list ::= ({arg_nr} tex2html_wrap_inline2789 )


A chunk is a 2-argumented structure composed of the tag chunk, a list of denotative literals called chunk_guards with an additional evaluative literal called call_literal as the last element, and some information about the chunk called chunk_descr.
If there are no call literals in the body of the clause, then the clause contains only one chunk ending with a denotative literal. We call this kind of chunk head_chunk_fact. In fact, all clauses with type rel0 or fun1den are constructed with only the head_chunk_fact.
If there is at least one call literal in the clause, then the first chunk ends with a call literal (first_premise_literal). All clauses with types different from rel0 and fun1den have a head_chunk_rule as their first chunk.
The classifier computes optimized register assignments for temporary variables. The information lu_reg tells the code generator which register is the last one used by the classifier. For example the code generator has to take register numbers higher than lu_reg for handling the permanent variables in the chunk. The pair (variable permvar_uselit_list) Ętells the code generator where the permanent variables occur in the call_literal of the chunk.


Prolog-like source:
foo(T,gamma) :- bar(T,P) !& bar(P,Q).
.  .  .
Lisp-like source:
(hn (foo alpha beta))
(ft (foo _t gamma) (bar _t _p) ! (bar _p _q))
.  .  .

Classified Clauses:

(db (proc foo/2 2 (indexing ...)
       (rel0                    ; hn-clause without body goals
             (cut-info nil)
             (chunk             ; The tag for the first chunk.
                   (head_literal) ; There exists only the head literal
                   nil) )       ; There is no need for any chunk_descr

              (cut-info general)
              (perm (_p (1 nil (2 1))))
              (temp (_t (1 (1) (1)))
                    (_q (2 nil (2))))
              (chunk        ; The tag for the first chunk.
                    ((usrlit ...))    ; head_literal  first_premise_literal
                    (2 ((_p (2)))) ); lu_reg = 2 because of the arity
                                ; of the first_premise_literal. The
                                ; permanent variable _p occurs at
                                ; position 2 in the call_literal.
              (chunk            ; The tag for the second chunk.
                    ((usrlit ...))    ; there is only a call_literal.
                    (2 ((_p (1))))))) ; _p occurs at position 1
                                      ; in the call_literal.
    .  .  .)

Harold Boley (