next up previous contents
Next: Morphology and Linearization Up: FUF: the Universal Unifier Previous: Procedural Types

   
EXTERNAL and Unification Macros

The External specification allows the grammar writer to produce the constraints of a grammar in a ``lazy'' way, specifying pieces of the grammar only when needed. External also provides a way of developing ``macros'' in a grammar.

The mechanism is the following: (u x <external>) stops the unification, call the external function specified in the external construct, and uses the value returned to continue as in (u x <value>). External functions expect one argument: the path where the value they return will be used.

The syntax is the following:

          

((a EXTERNAL))

or

((a #(EXTERNAL <function>)))

In the short form (external only), the external function used is the value of the variable *default-external-value*. Otherwise, the name of the function is explicitly specified.  

There are two reasons to use an external construct:

1.
The same portion of the grammar is repeated over and over in different places. Extract this repeating portion, give it a name as a portion, and use the function as a ``macro'' in the grammar. An example of this sort can be found in file gr6.l in the example directory. The macro is called role-exists.

2.
There are constraints that are better expressed at run-time, when some other parameters, external to the unification process, have been calculated. The external construct actually allows a coroutine-like interaction between two processes. This can be used for example to implement a cooperation similar to the one described in the TELEGRAM system [#!Appelt83!#] between a planner and the unifier. A similar mechanism can be used in the following setting: a unification-based lexical chooser must interact with a knowledge base to decide what lexical items to use. The input given to the lexical chooser only contains pointers to concepts in the knowledge base. When the lexical chooser must make a decision, it needs more information from the knowledge base. The external construct allows the lexical chooser to pull information from the knowledge base only when it needs it. Therefore, the input does not need to contain all the information that might be needed but only the entry-points to the knowledge base necessary to identify the additional information that may turn out to be relevant under certain conditions.


next up previous contents
Next: Morphology and Linearization Up: FUF: the Universal Unifier Previous: Procedural Types
Michael Elhadad - elhadad@cs.bgu.ac.il