next up previous contents
Next: 4.4 Chunk level Up: 4 The classifier Previous: 4.2 Indexing

4.3 Clause level


clause_classification 		 ::= 		 (clause_type cut_info perm_var_list temp_var_list chunk_sequence)

chunk_sequence ::= head_chunk_fact tex2html_wrap_inline2907 head_chunk_rule body_chunk_list

cut_info ::= (cut-info cut_type)

perm_var_list ::= (perm {global_perm_var_descr}*)

temp_var_list ::= (temp {global_temp_var_descr}*)

cut_type ::= lonely tex2html_wrap_inline2907 first tex2html_wrap_inline2907 last tex2html_wrap_inline2907 general tex2html_wrap_inline2907 nil

global_perm_var_descr ::= (variable perm_descr)

global_temp_var_descr ::= (variable temp_descr)

perm_descr ::= (Y-reg_nr use_head (last_chunk last_chunkliteral))

temp_descr ::= (X-reg_nr use_head use_premise)


The clause_type describes the kind of clauses, which are distinguished in rel0, fun1den, fun1eva, fun*den, fun*eva. We give the type rel0 to a hn-clause without any body literal. Thus rel0 tags an ordinary fact, as known from PROLOG. The ``1'' in the types fun1den and fun1eva indicates that the clause contains only one chunk. Hence ``*'' means the clause contains two or more chunks. ``den'' stands for denotative foot and ``eva'' for evaluative foot. It should be noted that an hn-clause with an evaluative last body literal still is a ``den''-like clause, because hn-clauses implicitly return the value true and not the value of their last premise
(Information about the occurrence of a cut in the clause) The cut_info contains exactly one argument, cut_type, which maps directly to the corresponding GWAM-instructions (see section 7). The cut_type argument is nil if there is no cut. Since currently RELFUN clauses always return a value, only first and general are in use.
(Global information about the permanent variables of the clause) An element of the perm_var_list is a pair of the form: (variable perm_descr). The perm_descr is a 3-tuple describing a) where the variable has to be located in the local environment in order to make optimum environment trimming, b) the occurrences in the head literal (a list of argument positions), and c) the last occurrence (the last chunk and the last literal in this chunk) of the variable in the clause.
(Global information about the temporary variables in the clause) The temp_var_list describes a) which register (or X-reg_nr) has to be assigned to the temporary variable for register optimization on the machine level, b) the occurrence in the head literal (or use_head), and c) the call literal (or use_premise). A temporary variable occurs only in one chunk by definition; in this way the call literal is unique and it is possible that neither use_head nor use_premise are different from the empty list nil.


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 (foo alpha ...)
                               ; without body goals
                (cut-info nil) ; there is no cut
                (perm)         ; there are no permanent variables
                (temp)         ; there are no temporary variables
                (chunk .  .  .))   ; head_chunk_fact

          (fun*eva           ; the ft-clause (foo _t ...). The
                             ; clause contains two small chunks
                             ; and an evaluative foot calling bar/2
                (cut-info general)
                (perm (_p (1 nil (2 1)))); Permanent variable _p.
                             ; _p is assigned to the Y-reg 1 in the
                             ; local environment. _p doesn't occur
                             ; in the head. Its last occurrence is
                             ; in the second chunk and as the first
                             ; literal in the chunk.

                (temp (_t (1 (1) (1))) ; The temporary variable _t.
                              ; _t is assigned to the X-reg 1. It
                              ; has an arg-1 occurrence in the head.
                              ; Its call literal in the chunk is
                              ; in the argument position 1.
                      (_q (2 nil (2)))) ; _q is assigned to register 2
                              ; because its occurrence in the call
                              ; literal is at argument position 2.
                              ; It has no head occurrence.
                (chunk .  .  .)   ; head_chunk_rule
                (chunk .  .  .))  ; body_chunk
     .  .  . )

next up previous contents
Next: 4.4 Chunk level Up: 4 The classifier Previous: 4.2 Indexing

Harold Boley (