next up previous contents
Next: The trace-enable and trace-disable Up: Local tracing with boundaries Previous: Special Flags %trace-on% and

The Special Tracing Flag %break%

The special tracing flag %break% is used to trigger a break in the execution of FUF. When found by FUF, a Lisp continuable break is triggered. It is then possible to examine the current state of the unification using the Lisp debugger. Using the Lisp debugger, it is then possible to either resume unification or abort it. Within the debugger, the total fd can be inspected (and modified) by using the function path-value and set-path-value. A typical session is shown below:

          

(setq *u-grammar* '((alt (((cat clause) (pattern (s v o)) (s ((cat np))) (v ((cat v))) (o ((cat np)))) ((cat np) %break%) ((cat v) %break%)))))

;; The np and v branch are not yet written - a break is inserted ;; The developer can then insert new values manually during unification.

LISP> (uni '((cat clause) (s ((lex `John'))) (v ((lex `like'))) (o ((lex `Mary')))))

>

>======================================== >STARTING CAT CLAUSE AT LEVEL {} >========================================

>Expanding constituent {} into cset ({O} {V} {S}). >

>======================================== >STARTING CAT NP AT LEVEL {O} >========================================

Break: Break in grammar

Restart actions (select using :continue): 0: return from break. [1c] FUG5 23> (path-value {o})

((LEX `Mary') (CAT NP)) [1c] FUG5 24> (path-value {n})

((LEX `John') (CAT NP))

[1c] FUG5 25> :cont

>Constituent {O} is a leaf. >

>======================================== >STARTING CAT V AT LEVEL {V} >========================================

Break: Break in grammar

Restart actions (select using :continue): 0: return from break. [1c] FUG5 26> :reset

FUG5 27>

The behavior of the debugger depends on which version of Common Lisp you are using. The example shown here is run under Franz Inc's Allegro Common Lisp. Consult your Lisp manual to find out the details of how to resume processing (the :cont command in ACL) and abort processing (the :res command in ACL). Another source of variation is whether the {} notation is recognized within the debugger or not. This notation is implemented using macro characters in Lisp. Macro-characters are recognized in ACL's debugger but not in Lucid Common Lisp's implementation. For that reason, the function path-value accepts as parameter either a path or simply a list of attributes.  

The function path-value returns the value of a path in the current total FD. It is useful to inspect the current value of the total FD. The function set-path-value is also defined to change a value within the total FD. Note that it's use is highly dangerous.

          
(path-value path-or-list)  Return the value of path in the current total FD.

(set-path-value path-or-list FD) Set the value of a path in the current total FD to FD.

Examples:

(path-value {process v}) (path-value '(process v)) ;; equivalent form when the {} notation is not ;; recognized

(set-path-value {process v} '((lex `take')))

(set-path-value {process v} (u (path-value {process v}) '((tense past)))) ;; u performs a simple unification between fds.

 

For more general access, the total FD is accessible in the special variable *input* and it can be modified in any possible ways. But if you do follow this way, there is a high probability that the unification will not be able to proceed normally. Note that there is no way to easily remove a conflation from the total FD using only path-value and set-path-value because path-value always follows the paths until a non-path value can be returned. The following example illustrates this limitation:

          
(setq *input* '((a {b})
                (b ((b1 1)))))

(path-value {a}) -> ((b1 1))

(set-path-value {a} '((b1 2)))

(path-value {}) -> ((a {b}) (b ((b1 2))))

;; Cannot just with path-value and set-path-value remove the conflation ;; between a and b (a {b}).

One last word of caution: when using set-path-value, relative paths are made absolute before being inserted relative to the path of insertion given as parameter. Since the relative path notation can be ambiguous (cf p.[*]), this can, under circumstances where there is an ambiguity, create unexpected results.


next up previous contents
Next: The trace-enable and trace-disable Up: Local tracing with boundaries Previous: Special Flags %trace-on% and
Michael Elhadad - elhadad@cs.bgu.ac.il