next up previous contents
Next: Local tracing with boundaries Up: Tracing and Debugging Previous: Levels of Tracing

         
Tracing of Alternatives and Options

To follow the unifier as it proceeds through the grammar, the most useful trace is generated by giving a name to an alternative of the grammar. It is done by adding an atomic name after the keywords alt, ralt or opt in the grammar:

          
       ((alt PASSIVE
	 (
	  ;; branch 1 of alt passive
	  ((verb ((voice passive)))
	   (prot none))

;; branch 2 of alt passive ((verb ((voice passive))) (prot any) (prot ((cat np))) (by-obj ((cat pp) (prep ((lex `by'))) (np (^ prot)))) (pattern (dots verb by-obj dots)))))

;; body of alt passive (common to all branches) (verb ((cat verb-group))) ...)

Here, this fraction of the grammar has been marked by the directive: (alt PASSIVE ...). (An equivalent notation is (alt (:trace PASSIVE) ...).) The effect will be that all unification done subsequently will be traced, producing the following output:

          
        -> Entering ALT PASSIVE
        -> Trying Branch #1 in ALT PASSIVE:
        -> Fail on trying (prot none) with
                           (prot ((nnp ((n ((lex boy)))))))
        -> Trying Branch #2 in ALT PASSIVE:
        ...
          
          

If a traced alternative is found later in the grammar, the level of indentation will increase. If the level of indentation decreases, that means a whole (alt ...) has failed. It is indicated by the output:  

          
        -> Fail on ALT PROT.
          
          

The possible messages printed when the grammar is traced are:  

          
Move in the alternatives:
        ENTERING ALT f: BRANCH #i
        FAIL IN ALT f
        When the alt is indexed:
        ENTERING ALT f - JUMP INDEXED TO BRANCH #i INDEX-NAME
        NO VALUE GIVEN IN INPUT FOR INDEX INDEX-NAME - NO JUMP
For options:
	TRYING WITH OPTION o
	TRYING WITHOUT OPTION o
Regular unification:
        ENRICHING INPUT WITH s AT LEVEL l
        FAIL IN TRYING s with s AT LEVEL l
Pattern unification:
        UNIFYING PATTERN p with p
        TRYING PATTERN p
        ADDING CONSTRAINTS c
        FAIL ON PATTERN p
Unification between pointers to constituents:
        UPDATING s WITH VALUE s AT LEVEL l
        s BECOMES A POINTER TO s AT LEVEL l
        UPDATING BOTH PATHS TO A BOUND
          
          


next up previous contents
Next: Local tracing with boundaries Up: Tracing and Debugging Previous: Levels of Tracing
Michael Elhadad - elhadad@cs.bgu.ac.il