Grail Tutorial - Differences between Grail 2 and Grail 3 grammar files

Grammars written for Grail 2 and Grail 3 are interchangeable to a large extent. Though some of the optimization predicates are different, in most cases this should not make a difference to using the same grammar with both Grail 2 and Grail 3. This page discusses the changes to make to your grammar in order to adapt a Grail 2 grammar for use with Grail 3 or vice versa.

Grail 2 is quite picky about the predicates which can occur in a grammar file and will complain if it finds any of Grail 3's new declarations in a grammar. However, these warnings will not prevent Grail 2 from loading Grail 3 grammars.

Continuous declarations

Designating a mode i as continuous in Grail 3, using a declaration.

continuous(i).

Does not have the same meaning in Grail 2 as it does in Grail 3. In both versions, declaring a mode as continuous will cause Grail to apply the string pair labeling for Lambek calculus proof nets to recursively assign a pair of string positions to each subformula and finally to the atomic formulas. Two atomic formulas can be matched only if these string positions are compatible.

Compared to Grail 2, Grail 3 uses a more powerful mechanism which allows the user to specify custom_first_order override these basic assignments. This allows a Grail 3 grammar to use a continuous declaration for a mode which, according to Grail 2, would not be continuous. In general, the best strategy to convert a Grail 3 grammar to Grail 2 is to remove all continuous declarations for modes which have a custom_first_order declaration in Grail 3.

Inert declarations

These have not effect in Grail 2.

Lazy declarations

Grail 2 uses eager evaluation on all contractions, unless there is a lazy declaration for this mode, in which case no contractions are performed until all connections have been made. Grail 3 automatically performs lazy evaluation on all modes, so these declarations are unnecessary.
Richard.Moot@labri.fr
Last modified: Mon Feb 16 17:12:05 CET 2009