Benoît Crabbé
email: bcrabbe@linguist.jussieu.fr.

Denys Duchier
email: denys.duchier@univ-orleans.fr.

Claire Gardent
email: gardent@loria.fr.

Joseph Le Roux
email: leroux@univ-paris13.fr

Yannick Parmentier
email: yannick.parmentier@univ-orleans.fr.

XMG : eXtensible MetaGrammar

à la diffusion de documents scientifiques de niveau recherche, publiés ou non, émanant des établissements d'enseignement et de recherche français ou étrangers, des laboratoires publics ou privés.

Introduction

In the late eighties and early nineties, many grammar engineering environments were developed to support the specification of large computational grammars for natural language. One may for instance cite XLE [START_REF] Kaplan | Lexical Resource Reconciliation in the Xerox Linguistic Environment[END_REF] for specifying Lexical-Functional Grammars (LFG), LKB (Copestake and Flickinger 2000) for specifying Headdriven Phrase Structure Grammars (HPSG), and DOTCCG [START_REF] Baldridge | DotCCG and VisCCG: Wiki and programming paradigms for improved grammar engineering with OpenCCG[END_REF]) for specifying Combinatory Categorial Grammars (CCG). Concretely, such environments usually rely on (i) a formal language used to describe a target computational grammar, and (ii) a processor for this language, which aims at generating the actual described grammar (and potentially at checking it, e.g., by feeding it to a parser).

While these environments were tailored for specific grammar formalisms, they share a number of features. Firstly, they are expressive enough to characterize subsets of natural language. Following [START_REF] Shieber | The design of a computer language for linguistic information[END_REF], we call this feature weak completeness. Secondly, they are notationally expressive enough to relatively easily formalize important theoretical notions. Thirdly, they are rigorous, that is, the semantics of their underlying language is well defined and understood. Additionally, for an environment to be useful in practice, it should be simple to use (by a linguist), and make it possible to detect errors in the described target grammar.

If we consider a particular type of computational grammars, namely tree based grammars, that is grammars where the basic units are trees (or tree descriptions) of arbitrary depth, such as Tree-Adjoining Grammar (TAG, [START_REF] Joshi | Tree adjunct grammars[END_REF]), D-Tree Grammar (DTG, [START_REF] Rambow | D-tree Grammars[END_REF]), Tree Description Grammars (TDG [START_REF] Kallmeyer | Tree Description Grammars and Underspecified Representations[END_REF])) or Interaction Grammars (IG, [START_REF] Perrier | Interaction Grammars[END_REF]), environments sharing all of the above features are lacking. As we shall see in the Section 7 of this article, there have been some proposals for grammar engineering environments for tree based grammar, for example [START_REF] Candito | A principle-based hierarchical representation of LTAGs[END_REF], [START_REF] Xia | Toward semi-automating grammar development[END_REF], but these lack notational expressivity. This is partly due to the fact that tree based formalisms offer an extended domain of locality where one can encode constraints between remote syntactic constituents. If one wants to define such constraints while giving a modular and incremental specification of the grammar, one needs a high level of notational expressivity, as we shall see throughout the article (and especially in Section 4).

In this article, we present XMG (eXtensible MetaGrammar), a framework for specifying tree based grammars. Focusing mostly on FB-LTAG (but using IG and MC-TAG to illustrate flexibility), we argue that XMG departs from other existing computational frameworks for designing tree based grammars in three main ways:

• First, XMG is a declarative language. In other words, grammaticality is defined in an order-independent fashion by a set of well-formedness constraints rather than by procedures. In particular, XMG permits a fully declarative treatment of diathesis that markedly departs from the procedural rules (called meta-or lexical rules) previously used to specify tree based grammars.

• Second, XMG is notationally expressive. The XMG language supports full disjunction and conjunction of grammatical units, a modular treatment of multiple linguistic dimensions, multiple inheritance of units and a sophisticated treatment of identifiers.

We illustrate XMG's notational expressivity by showing (i) how it facilitates the modelling of the tree fragment hierarchies required to specify tree based grammars and (ii) how it permits a natural modelling of the syntax/semantic interface between semantic representations and syntactic trees as can be used in FB-LTAG.

• Third, XMG is extensible in that its computational architecture facilitates (i) the integration of an arbitrary number of linguistic dimensions (syntax, semantics, etc.), (ii) the modelling of different grammar formalisms (FB-LTAG, MC-TAG, IG) and (iii) the specification of general linguistic principles (e.g., clitic ordering in French).

The article is structured as follows. Section 2 starts by giving a brief introduction to FB-LTAG, the grammar formalism we used to illustrate most of XMG's features. The next three sections then go on to discuss and illustrate XMG's three main features namely, declarativity, notational expressivity and flexibility. In section 3, we focus on declarativity and show how XMG's generalized disjunction permits a declarative encoding of diathesis. We then contrast the XMG approach with the procedural methods previously resorted to for specifying FB-LTAG. Section 4 addresses notational expressivity. We present the syntax of XMG and show how the sophisticated identifier handling it supports permits a natural treatment (i) of identifiers in tree based hierarchies and (ii) of the unification based syntax/semantics interface often used in FB-LTAG. In section 5, we concentrate on extensibility. We first describe the operational semantics of XMG and the architecture of the XMG compiler. We then show how these facilitate the adaptation of the basic XMG language to (i) different grammar formalisms (IG, MC-TAG, FB-LTAG), (ii) the integration of specific linguistic principles such as clitic ordering constraints and (iii) the specification of an arbitrary number of linguistic dimensions. In Section 6, we illustrate the usage of XMG by presenting an XMG specification for the verbal fragment of a large scale FB-LTAG for French augmented with a unification-based semantics. We also briefly describe the various other tree-based grammars implemented using XMG. Section 7 discusses the limitations of other approaches to the formal specification of tree based grammars, while Section 8 concludes with pointers for further research.

Tree-Adjoining Grammar

A Tree Adjoining Grammar consists of a set of auxiliary or initial elementary trees and of two tree composition operations namely, substitution and adjunction. Initial trees are trees whose leaves are either substitution nodes (marked with ↓) or terminal symbols (words). Auxiliary trees are distinguished by a foot node (marked with ⋆) whose category must be the same as that of the root node. Substitution inserts a tree onto a substitution node of some other tree while adjunction inserts an auxiliary tree into a tree. Figure 1 shows a toy TAG generating the sentence Marie a vu Jean 'Mary has seen John' and sketches its derivation. 1Among existing variants of TAG, a commonly used in practice is Lexicalised Feature-Based Tree-Adjoining Grammar (FB-LTAG, (Vijay-Shanker and Joshi 1988)). A lexicalised TAG is such that each elementary tree has at least one leaf labelled with a lexical item (word) while in an FB-LTAG, tree nodes are additionally decorated with two feature structures (called top and bottom). These feature structures are unified during derivation as follows. On substitution, the top features of the substitution node are unified with the top features of the root node of the tree being substituted in.

On adjunction, the top features of the root of the auxiliary tree are unified with the top features of the node where adjunction takes place; and the bottom features of the foot node of the auxiliary tree are unified with the bottom features of the node where adjunction takes place. At the end of a derivation, the top and bottom feature structures of all nodes in the derived tree are unified.

Implementation of Tree-Adjoining Grammars. Most existing implementations of Tree-Adjoining Grammars follow the three-layer architecture adopted for the XTAG grammar (XTAG Research Group 2001), a Feature-Based Lexicalised TAG for English. Thus the grammar consists of (i) a set of so-called tree schemas (i.e., elementary trees having a leaf node labelled with a ⋄ referring to where to anchor lexical items2 ), (ii) a morphological lexicon associating words with lemmas and (iii) a syntactic lexicon associating lemmas with tree schemas (these are gathered into families according to syntactic properties, such as the sub-categorization frame for verbs). Figure 2 shows some of the tree schemas associated with transitive verbs in the XTAG grammar. The tree (a) corresponds to a declarative sentence, (b) to a WH-question on the subject, (c) to a passive clause with a BY-agent and (d) to a passive clause with a WH-object. As can be seen, each tree schema contains an anchor node (marked with ⋄). During parsing this anchor node can be replaced by any word morphologically related to a lemma listed in the syntactic lexicon as anchoring the transitive tree family. This concept of tree family allows us to share structural information (tree schemas) between words having common syntactic properties (e.g., sub-categorization frames). There still remains a large redundancy within the grammar since many elementary tree schemas share common subtrees (large coverage Tree Adjoining Grammars usually consist of hundreds, sometimes thousands, of tree schemas). An important issue when specifying such grammars is thus structure sharing. Being able to share structural information is necessary not only for a faster grammar development, but also for an easier grammar maintenance (modifications to be applied to the tree schemas would be restricted to shared structures). In the next Section, we will see how XMG declarativity can be efficiently used to factorize Tree Adjoining Grammars. In addition, Section 4 will show how XMG notational expressivity facilitates the specification of another commonly used tree sharing device, namely inheritance hierarchies of tree fragments.

(a) (b) S r NP 0 ↓ VP V⋄ NP 1 ↓ S q NP 0 ↓ wh + [] S r NP NA ǫ VP V⋄ NP 1 ↓ (c) (d) S r [] mode 3 NP 1 ↓ VP mode 3   passive 1 mode 2   V⋄   passive 1 + mode 2 ppart   [] PP P by NP 0 ↓ S q NP 1 ↓ wh + [] S r [] mode 3 NP NA ǫ VP mode 3   passive 1 mode 2   V⋄   passive 1 + mode 2 ppart   [] PP P by NP 0 ↓

Figure 2

Some tree schemas for English transitive verbs

Extending TAG with a unification-based semantics. To extend FB-LTAG with a compositional semantics, [START_REF] Gardent | Semantic Construction in Feature-Based Tree Adjoining Grammar[END_REF] propose to associate each elementary tree with a flat semantic representation. For instance, in Figure 2, the trees3 for John, runs and often are associated with the semantics l 0 :name(j,john), l 1 :run(e,s) and l 2 :often(x) respectively. Importantly, the arguments of semantic functors are represented by unification variables which occur both in the semantic representation of this functor and on some nodes of the associated syntactic tree. Thus in Figure 2, the semantic index s occurring in the semantic representation of runs also occurs on the subject substitution node of the associated elementary tree. The value of semantic arguments is then determined by the unifications resulting from adjunction and substitution. For instance, the semantic index s in the tree for runs is unified during substitution with the semantic index j labelling the root node of the tree for John. As a result, the semantics of John often runs is {l 0 :name(j,john), l 1 :run(e,j), l 2 :often(e)}. [START_REF] Gardent | Semantic Construction in Feature-Based Tree Adjoining Grammar[END_REF]'s proposal was applied to various semantic phenomena (Kallmeyer and Romero 2004a, 2004b, 2008). Its implementation however relies on having a computational framework which associates syntactic trees with flat semantic formulae while allowing for shared variables between trees and formulae. In the following sections, we will show how XMG notational expressivity makes it possible to specify an FB-LTAG equipped with a unification based semantics. ⇒ l 0 :name(j,john), l 1 :run(e,j), l 2 :often(e)

Figure 3

A toy lexicalised FTAG with unification-based semantics (l 0 , l 1 , l 2 , e and j are constants while s, f, g, x are unification variables).

Declarativity

In this section, we show how a phenomenon which is often handled in a procedural way by existing approaches, can be provided with a declarative specification in XMG.

Concretely, we show how XMG supports a declarative account of diathesis that avoids the drawbacks of lexical rules (e.g., information erasing). We start by presenting the lexical rule approach. We then contrast it with the XMG account.

Capturing diathesis using lexical rules

Following [START_REF] Flickinger | Lexical Rules in the Hierarchical Lexicon[END_REF], redundancy among grammatical descriptions is often handled using two devices: an inheritance hierarchy and a set of lexical rules. While the inheritance hierarchy permits us to encode the sharing of common substructures, lexical rules (sometimes called meta-rules) permits us to capture relationships between trees by deriving new trees from already specified ones. For instance, passive trees will be derived from active ones. Although [START_REF] Flickinger | Lexical Rules in the Hierarchical Lexicon[END_REF]'s approach was developed for Head-Driven Phrase Structure Grammar (HPSG), several similar approaches have been put forward for FB-LTAG [START_REF] Vijay-Shanker | Structure sharing in lexicalized tree adjoining grammars[END_REF][START_REF] Becker | HyTAG: A new Type of Tree Adjoining Grammars for Hybrid Syntactic Representation of Free Word Order Language[END_REF][START_REF] Evans | Encoding lexicalized tree adjoining grammars with a nonmonotonic inheritance hierarchy[END_REF]XTAG Research Group 2001). One important drawback of these approaches however, is that they are procedural in that the order in which lexical rules apply matters. For instance, consider again the set of trees given in Figure 2. In the meta-rule representation scheme adopted by [START_REF] Becker | HyTAG: A new Type of Tree Adjoining Grammars for Hybrid Syntactic Representation of Free Word Order Language[END_REF], the base tree (a) would be specified in the inheritance hierarchy grouping all base trees, and the derived trees (b,c,d) would be generated by applying one or more meta-rules on this base tree. Figure 4 sketches these meta-rules. The left hand side of the meta-rule is a matching pattern replaced with the right hand side of the meta-rule in the newly generated tree. Symbol "?" denotes a meta-variable whose matching subtree in the input is substituted in place of the variable in the output tree. Given these, the tree family in Figure 2 is generated as follows: (b) and (c) are generated by application to the base tree (a) of the Wh-Subject and Passive meta-rules respectively. Further, (d) is generated by applying first, the Wh-Subject meta-rule and second, the Passive meta-rule to the base tree.

More generally a meta-rule is a procedural device that given a tree instance, generates a new tree instance by adding, suppressing (hence possibly substituting) information in grammatical units. [START_REF] Prolo | Generating the XTAG English Grammar Using Metarules[END_REF] defines a set of meta-rules which can be used to specify a large FB-LTAG for English. Given an ordered set of meta-rules however,

Passive meta-rule

Wh-Subject meta-rule

Sr ?1 NP? VP V ?2 NP? ⇒ Sr [] mode 3 ?2 NP? VP mode 3   mode 2 passive 1   V   passive 1 + mode 2 ppart   [] PP P by ?1 NP? S r ?2NP ? ↓ ?1 ⇒ S q ?2NP ? ↓ wh + [] S r NP↓ N A ǫ ?1

Figure 4

Simplified meta-rules for passive and wh-subject extraction there is no guarantee that the trees they derive are linguistically appropriate and that the derivation process terminates. Thus to ensure termination and consistency, [START_REF] Prolo | Generating the XTAG English Grammar Using Metarules[END_REF] needs to additionally provide rule ordering schemes (expressed as automata).

XMG: capturing diathesis using disjunction

XMG provides an alternative account for describing tree sets such as that of Figure 2 without lexical rules and without the related ordering constraints. In essence, the approach consists in enumerating trees by combining tree fragments using conjunction and disjunction. More specifically, the tree set given in Figure 2 can be generated by combining some of the tree fragments sketched in Figure 5 using the following conjunctions and disjunctions:4

Subject → CanonicalSubject ∨ Wh-NP-Subject (1) ActiveTransitiveVerb → Subject ∧ ActiveVerb ∧ CanonicalObject (2) PassiveTransitiveVerb → Subject ∧ PassiveVerb ∧ CanonicalByObject (3) TransitiveVerb → ActiveTransitiveVerb ∨ PassiveTransitiveVerb (4)
The first clause (Subject) groups together two subtrees representing the possible realizations of a subject (canonical and wh). The next two clauses define a tree set for active and passive transitive verbs respectively. The last clause defines the TransitiveVerb family as a disjunction of the two verb forms (passive or active). In sum, the Transitive-Verb clause defines the tree set sketched in Figure 2 as a disjunction of conjunctions of tree fragments.

One of the issues of meta-rules reported by [START_REF] Prolo | Generating the XTAG English Grammar Using Metarules[END_REF] is the handling of feature equations. For a number of cases (including subject relativization in passive trees), adhoc meta-rules are needed, for a unified tree transformation cannot be defined. In a declarative approach such as the one above, dealing with feature equations can be done relatively easily. Let us imagine we now want to extend the trees of Figure 2

mode 3 VP mode 3   passive 1 mode 2   V⋄   passive 1 + mode 2 ppart   []

Figure 5

Tree fragments equations for subject number agreement. We can for instance do so by defining the tree fragment below (the dashed line indicates that the VP node can be a descendant, not only a daughter, of the S node):

5 SubjAgreement → S NP↓ num 1 pnum 1 VP num 1 num 1
Then we extend the definition of Subject as follows:

Subject → SubjAgreement ∧ ( CanonicalSubject ∨ Wh-NP-Subject ) (5)
If we want to get further with the description of transitive verbs, for instance by taking into account wh-objects and by-objects, this can be done as follows. We first define the elementary fragments Wh-NP-Object and Wh-By-Object (see Figure 5), and then define the following additional combinations:6

ActiveTransitiveVerb → CanonicalSubject ∧ ActiveVerb ∧ Wh-Np-Object (6) PassiveTransitiveVerb → CanonicalSubject ∧ PassiveVerb ∧ Wh-By-Object (7)
Evans et al. (1995) argue for the necessity of using lexical rules for grammatical description based on two arguments: (i) morphology is irregular and has to be handled by a non monotonic device and (ii) erasing rules such as the agentless passive (John eats an apple / An apple is eaten ) are needed to erase an argument from the canonical base tree. Neither of these arguments holds here however: the first argument because we describe tree schema hence lexical and morphological issues are ruled out; the second because agentless passive and more generally, argument erasing constructions, can simply be defined by an additional clause such as:

AgentlessPassiveTransitiveVerb → Subject ∧ PassiveVerb (8)
To sum up, using a declarative language to specify a tree based grammar offer an adequate level of control on the structures being described while avoiding to deal with ordering and termination issues. It facilitates grammar design and maintenance, by providing an abstract view on grammar trees, uniquely made of monotonic (no information removal) combinations of tree fragments.

Notational expressivity

We now focus on notational expressivity and show how XMG supports a direct encoding of (i) distinct linguistic dimensions (here syntax, semantics and the syntax/semantics interface) and (ii) the various types of coreferences7 which arise in the development of tree based grammars.

The syntax of the XMG language can be formally defined as follows.

Class ::= Name C 1 ,...,C k x 1 ,...,x n → Content (9) Content ::= SYN, SEM, DYN | Name | Content ∧ Content | Content ∨ Content (10) SYN ::= n 1 → n 2 | n 1 → + n 2 | n 1 → * n 2 | n 1 ≺ n 2 | n 1 ≺ + n 2 | n 1 ≺ * n 2 | n 1 [f 1 : v 1 , ... , f k : v k ] | n 1 (c 1 : cv 1 , ... , c l : cv l ) | n 1 = n 2 | x = C i .y | n 1 (c 1 : cv 1 , ... , c l : cv l ) [f 1 : v 1 , ... , f k : v k ] | SYN ∧ SYN (11) SEM ::= l i : p(E 1 , ..., E n ) | l i ≤ h j | SEM ∧ SEM (12) DYN ::= f 1 : v 1 , ... , f n : v n (13)
Here and in what follows, we use the following notational conventions. C i denote variables over class names, x i , x and y are variables ranging over tree nodes or feature values, n i refer to node variables, f, f i are features and v, v i , feature values (constants or variables), l i , h j , p and E i are variables over semantic labels, semantic holes, predicates and predicate arguments in flat semantic formulae respectively. 8 [ ] are used to associate a node variable with some feature constraint. ( ) are used to associate a node variable with some property constraint (e.g., node colors, see Section 5). c i and cv i denote a property constraint and a property constraint value respectively. C 1 .y denotes the y variable declared in class C i and = is unification; ≺ and → denote linear precedence and immediate dominance relations between nodes. Finally, +, * represent the transitive and transitive-reflexive closure of a relation respectively.

The first two clauses of the formal definition above specify XMG classes and how they combine. The next three clauses define the languages supported for describing three linguistic dimensions, namely syntax (SY N ), semantics (SEM ) and the syntax/semantics interface (called DY N for dynamic interface). We now discuss each of these in more details starting bottom-up with the three linguistic dimensions and ending with the control language that permits us to combine basic linguistic units into bigger ones.

SYN. The XMG formalism for syntax (copied below for convenience) is a tree description logic similar to that proposed by Vijay-Shanker and Schabes (1992), [START_REF] Rogers | Obtaining trees from their descriptions: An application to tree-adjoining grammars[END_REF] to describe tree based grammars.

SYN

::= n 1 → n 2 | n 1 → + n 2 | n 1 → * n 2 | n 1 ≺ n 2 | n 1 ≺ + n 2 | n 1 ≺ * n 2 | n 1 [f 1 : v 1 , ... , f k : v k ] | n 1 (c 1 : cv 1 , ... , c l : cv l ) | n 1 = n 2 | x = C i .y | n 1 (c 1 : cv 1 , ... , c l : cv l ) [f 1 : v 1 , ... , f k : v k ] | SYN ∧ SYN
It includes tree node variables, feature names, feature values and feature variables. Tree node variables can be related by equality (node identification), precedence (immediate or non immediate) and dominance (immediate or non immediate). Tree nodes can also be labelled with feature structures of depth 2, that is, sets of feature/value pairs where feature values are either variables, constants (e.g., syntactic category), or non recursive feature structure (e.g., top and bot feature structures).

Here is a graphical illustration of how tree logic formulae can be used to describe tree fragments: the depicted tree fragment is a model satisfying the given formula.

n 1 → n 2 ∧ n 1 → n 3 ∧ n 2 ≺ n 3 ∧ n 1 [cat : S] ∧ n 2 (mark : subst) [cat : N P ] ∧ n 3 [cat : V P ] S NP↓ VP
One distinguishing feature of the XMG tree language is the introduction of node constraints (n 1 (c : cv)) which generalize Muskens and Krahmer's (1998) use of positive and negative node markings. Concretely, node constraints are attribute-value matrices, which contain information to be used when solving tree descriptions to produce grammar trees. In other words, node constraints are used to further restrict the set of models satisfying a tree description. As an example of node constraint, consider node annotations in FB-LTAG (foot node, substitution node, null-adjunction, etc.). Such annotations can be used as node constraints to allow the description solver to apply well-formedness constraints (e.g., there is at most one foot node).

Another interesting feature of XMG concerns the inclusion of the dot operator which permits us to identify variables across classes in cases where name sharing cannot be resorted to. When a variable y is declared in a class C, the latter being instantiated within a class D, y can be accessed from D by C.y (the identifier y still being available in D's namespace).

SEM. The semantic dimension supports a direct encoding of the flat semantic formulae used by [START_REF] Gardent | Semantic Construction in Feature-Based Tree Adjoining Grammar[END_REF]:

SEM ::= l i : p(E 1 , ..., E n ) | l i ≤ h j | SEM ∧ SEM
where l i : p(E 1 , ..., E n ) represents a predicate p with label l i and arguments E 1 , ..., E n whilst l i ≤ h j is a scope constraint between label l i and scope h j . Expressions (predicate arguments E i ) can refer to semantic holes, constants (atomic values) or unification variables (written x, y below).

For instance, the following flat semantic formula can be used to underspecify the meaning of the sentence "Every dog chases a cat":

l 0 : ∀(x, h 1 , h 2 ) ∧ l 1 ≤ h 1 ∧ l 1 : Dog(x) ∧ l 2 ≤ h 2 ∧ l 2 : Chase(x, y) ∧ l 3 : ∃(y, h 3 , h 4 ) ∧ l 4 ≤ h 3 ∧ l 4 : Cat(y) ∧ l 2 ≤ h 4 (14)
This formula denotes the two first order logic formulae below thereby describing the two possibles readings of this sentence9 .

l 0 : ∀(x, l 1 , l 3 ) ∧ l 1 : Dog(x) ∧ l 2 : Chase(x, y) ∧ l 3 : ∃(y, l 4 , l 2 ) ∧ l 4 : Cat(y) (15) l 0 : ∀(x, l 1 , l 2 ) ∧ l 1 : Dog(x) ∧ l 2 : Chase(x, y) ∧ l 3 : ∃(y, l 4 , l 0 ) ∧ l 4 : Cat(y) (16)
DYN. The DYN dimension generalizes Kinyon's hypertag [START_REF] Kinyon | Hypertags[END_REF] which are unified whenever two tree fragments are combined. Similarly, in XMG the DYN dimension is a feature structure that is unified whenever two XMG classes are combined through inheritance or through conjunction (see below, the discussion on XMG control language). For instance, the following constraints ensure a coreference between the index I occurring in the syntactic dimension and the argument X occurring in the semantic dimension (index subject and arg 1 are feature names, and E, I, X and V local unification variables).

C 1 → N ode [idx : I] ∧ index subject : I (17) C 2 → L : P (E) ∧ L : T heta 1 (E, X) ∧ arg 1 : X (18) SubjectArg 1 → C 1 ∧ C 2 ∧ index subject : V, arg 1 : V (19)
More generally, the DYN dimension permits us to unify nodes and feature values that belong to distinct classes and dimensions, and are thus often not related within the inheritance hierarchy. As we shall see in Section 6, the DYN dimension permits a modular account of the syntax/semantic interface in which linking constraints can be stipulated separately and reused to specify the various diatheses.

In other words, the DYN feature structure allows us to extend the scope of some specific variables, so that they can be unified with variables (or values) introduced in some other classes of the metagrammar. This concept of scope extension can be compared with that of hook in Copestake, Lascarides, and Flickinger (2001).

Control language. The linguistic units (named Content here) defined by the linguist can be abstracted and combined as follows:

Class ::= Name C 1 ,...,C k x 1 ,...,x n → Content Content ::= SYN, SEM, DYN | Name | Content ∧ Content | Content ∨ Content
The first clause states that the linguistic information encoded in Content is abstracted in a class named N ame and that this class inherits classes C 1 , . . . , C k and exports variables x 1 , . . . , x n . That is, XMG allows for abstraction, inheritance and variable exports. By default, variables (referring to nodes and feature values) are local to a class. However, export statements extend the scope of a variable to all sub classes. An exported variable can also be accessed from outside its class in case of class instantiation (using the dot operator introduced earlier in this section). The second clause states that an XMG class consists of a syntactic, a semantic and a dynamic description (each of them possibly empty): and that XMG classes can be combined by conjunction and disjunction and reused through class instantiation. The notation SYN, SEM, DYN represents simultaneous contributions (possibly empty) to all 3 dimensions. 10 The XMG control language differs from other frameworks used to specify tree based grammars (Vijay-Shanker and Schabes 1992; [START_REF] Xia | Consistent Grammar Development Using Partial-Tree Descriptions for LTAGs[END_REF][START_REF] Abeillé | Ftag: current status and parsing scheme[END_REF] in two main ways. First, it supports generalized conjunctions and disjunctions of classes. As shown in Section 3, this permits inter alia a declarative treatment of diathesis.

Second, it allows for both local and exported variables. As mentioned in Section 3, a common way to share structure within a tree-based grammar is to define an inheritance hierarchy of either tree fragments [START_REF] Evans | Encoding lexicalized tree adjoining grammars with a nonmonotonic inheritance hierarchy[END_REF] or tree descriptions [START_REF] Vijay-Shanker | Structure sharing in lexicalized tree adjoining grammars[END_REF][START_REF] Candito | A principle-based hierarchical representation of LTAGs[END_REF][START_REF] Xia | Automatic Grammar Generation from two Different Perspectives[END_REF]. When considering an FB-LTAG augmented with unification semantics, the hierarchy will additionally contain semantic representations and/or tuples made of tree fragments and semantic representations. In all cases, the question arises of how to handle identifiers across classes and more specifically, how to share them.

In Candito's approach (1996), tree nodes are referred to using constants so that multiple occurrences of the same node constant refer to the same node. As pointed out in [START_REF] Gardent | Coreference Handling in XMG[END_REF], global names have several non trivial shortcomings. First, they complicate grammar writing in that the grammar writer must remember the names used and their intended interpretation. Second, they fail to support multiple uses of the same class within one class. For instance, in French, some verbs sub-categorize for two prepositional phrases (PP). A natural way of deriving the tree for such verbs would be to combine a verbal tree fragment with two instances of a PP fragment. If however, the nodes in the PP fragment are labelled with global names, then the two occurrences of these nodes will be identified thereby blocking the production of the appropriate tree. 11 A less restrictive treatment of identifiers is proposed by Vijay-Shanker and Schabes (1992) where each tree description can be associated with a set of declared node variables and subsets of these node variables can be referred to by descriptions in the 10 While formally precise, this notation can be cumbersome. In the interest of legibility we adopt throughout the convention that SYN stands for SYN, , , SEM for , SEM, , ad DYN for , , DYN . 11 An analogous situation may arise in English with ditransitive verbs requiring two direct objects.

hierarchy that inherit from the description in which these node variables were declared. For instance, if entity A in the hierarchy declares such a special node variable X and B inherits from A, then X can be referred to in B using the notation A.X. 12XMG generalizes Vijay-Shanker and Schabes' approach (1992) by integrating an export mechanism that can be used to extend the scope of a given identifier (node or feature value variable) to classes that inherit from the exporting class. Thus if class B inherits from class A and class A exports variable X, then X is visible in B and its reuse forces identity. If B inherits from several classes and two (or more) of these inherited classes export the same variable name X, then X is not directly visible from B. It can be accessed though using the dot operator. First A is identified with a local variable (e.g., T = A), then T.X can be used to refer to the variable X exported by A.

To sum up, XMG allows for local variables to be exported to sub-classes as well as for prefixed variables i.e., variables that are prefixed (using the dot operator) with a reference to the class in which they are declared. In this way, the pitfalls introduced by global names are avoided while providing enough expressivity to handle variable coreference (via the definition of variable namespaces). Section 6 will further illustrate the use of the various coreference devices made available by XMG showing how they concretely facilitate grammar writing.

Let us finally illustrate variable handling with XMG on the example of Figure 2. Recall we define the trees of Figure 2 as the conjunctions and disjunctions of some tree fragments of Figure 5, such as:

Subject → SubjAgreement ∧ ( CanonicalSubject ∨ Wh-NP-Subject ) (20)
CanonicalSubject can be defined as a tree description formula as follows (only variables n 2 and n 3 are exported):

CanonicalSubject n 2 ,n 3 → n 1 → n 2 ∧ n 1 [cat : S] ∧ n 2 (mark : subst) [cat : N P ] ∧ n 1 → n 3 ∧ n 3 [cat : V P ] ∧ n 2 ≺ n 3 (21)
The class Wh-NP-Subject is defined accordingly (i.e., by means of a slightly more complex tree description formula using the n 2 and n 3 variable identifiers to refer to the nodes involved in subject agreement). The class SubjAgreement is defined slightly differently (we do not impose any tree relation between the node concerned with number agreement):

SubjAgreement n 1 ,n 2 → n 1 [[top : [num : x]] [bot : [num : x]]] ∧ n 2 [[top : [num : x]] [bot : [num : x]]] (22)
We can then explicitly control the way the fragments combine as follows:

Subject → C 1 = SubjAgreement n 1 ,n 2 ∧ C 2 = ( CanonicalSubject n 2 ,n 3 ∨ Wh-NP-Subject n 2 ,n 3 ) ∧ C 1 .n 1 = C 2 .n 2 ∧ C 1 .n 2 = C 2 .n 3 (23)
In this example, we see how to constrain, via variable export and unification, some given syntactic nodes to be labelled with feature structures defined somewhere else in the metagrammar. We use XMG's flexible management of variable scope to deal with node coreference. Compared with previous approaches on metagrammars such as [START_REF] Candito | A principle-based hierarchical representation of LTAGs[END_REF][START_REF] Xia | Automatic Grammar Generation from two Different Perspectives[END_REF], having the possibility to handle neither only global nor only local variables offers a high level of expressivity along with a precise control on the structures being described.

Extensibility

A third distinguishing feature of XMG is extensibility. XMG is extensible in that (i) dimensions can be added and (ii) each dimension can be associated with its own interpreter. In order to support an arbitrary number of dimensions, XMG relies on a device permitting the accumulation of an arbitrary number of types of literals, namely Extensible Definite Clause Grammar (EDCG) ( [START_REF] Roy | Extended dcg notation: A tool for applicative programming in prolog[END_REF]). Once literals are accumulated according to their type (i.e., each type of literals is accumulated separately), they can be fed to dedicated interpreters. Since each of these sets of literals represents formulas of a description language, these interpreters are solvers, whose role is to compute models satisfying the accumulated formulas. Via this concept of separated dimensions, XMG allows us (i) to describe different levels of language (not only syntax, but also semantics and potentially morphology,13 etc.), and (ii) to define linguistic principles (well-formedness constraints to be applied on the structures being described). These principles depend either on the dimension (e.g., scope constraints in flat semantics), the target formalism (e.g. cooccurrence predicatearguments in FB-LTAG) or the natural language (e.g., clitic ordering in Romance languages) being described.

In what follows, we start by showing how XMG handles dimensions independently from each other introducing EDCG (Section 5.1). We then summarize the architecture of the XMG system (Section 5.2). We finally show how different solvers can be used to implement various constraints on each of these dimensions (Section 5.3). In particular, we discuss three kinds of extensions implemented in XMG: extension to several grammar formalisms, integration of explicit linguistic generalizations and inclusion of color-based node marking to facilitate grammar writing.

XMG: accumulating and interpreting an arbitrary number of descriptions

Accumulating (tree) descriptions. First, let us notice that XMG is nothing else than a logic language à la Prolog (Duchier, Parmentier, and Petitjean 2012). More precisely, an XMG specification is a collection of Horn clauses, which contribute a declarative description of what a computational tree grammar is. Recall that the descriptions handled by XMG are in fact tuples of the form SY N, SEM, DY N . An XMG class can thus describe, in a non-exclusive way, any of these 3 levels of description. If one wants to add another level of description (i.e., another dimension), one needs to extend the arity of this tuple. Before discussing this, let us first see how such tuples are processed by XMG.

Logic

As mentioned above, XMG's control language is comparable to Horn clauses. A common way to represent Horn clauses is by using Definite Clause Grammar (DCG) [START_REF] Pereira | Definite clause grammars for language analysis -a survey of the formalism and a comparison to augmented transition networks[END_REF]. Concretely, a DCG is a rewriting system (namely a contextfree grammar), where the symbols of the rewriting rules are equipped with pairs of unification variables (these are usually called difference list or accumulator) (Blackburn, Bos, and Striegnitz 2006, page 100). As an illustration, consider the toy example below.

s --> np,vp. np --> det,n. vp --> v,np. vp --> v. det --> [the]. det --> [a]. n --> [cat]. n --> [mouse]. v --> [eats].
The string language described by this DCG can be obtained by submitting the query s(X,[]) where X is a unification variable to be bound with lists of facts (these being the sentences belonging to the string language). As we can easily see, this language contains the sentences "a cat eats", "the cat eats", "a mouse eats", "the mouse eats", "a cat eats a mouse", "a mouse eats a cat", etc.

Similarly, we can represent XMG classes as DCG clauses. For instance, the combinations of syntactic fragments given on page 8 can be rewritten as DCG clauses as follows:

subject --> canonicalSubject. subject --> whNpSubject. activeTransitiveVerb --> subject, activeVerb, canonicalObject. passiveTransitiveVerb --> subject, passiveVerb, canonicalByObject. transitiveVerb --> activeTransitiveVerb. transitiveVerb --> passiveTransitiveVerb.
Disjunctions (e.g., the subject specification) translate to multiple clauses with identical heads and conjunctions (e.g., activeTransitiveVerb) to a clause body.

In our case, the terminal symbols of the underlying DCG are not just facts, but tuples of descriptions. In other words, the DCG clause whose head is canonicalSubject is associated with a tuple of the following form (the dots have to be replaced with adequate descriptions, these can contain unification variables, whose scope is by default local to the clause):

canonicalSubject --> [desc(syn(...),sem(...),dyn(...))].

In order to allow for an extension of XMG to an arbitrary number of dimensions, instead of compiling XMG classes into a DCG whose accumulator stores tuples with a fixed arity, these classes are compiled into an EDCG ( [START_REF] Roy | Extended dcg notation: A tool for applicative programming in prolog[END_REF]. EDCG are DCG with multiple accumulators. In XMG, each dimension is thus allocated a dedicated accumulator in the underlying EDCG.

Note that although the content of the various dimensions is accumulated separately, dimensions may nevertheless share information either via local unification variables (if the XMG class defines several dimensions locally), or via exported unification variables (in case of class instantiation or inheritance), or via the shared unification variables supported by the DYN dimension.

At the end of the EDCG execution, we obtain, for each axiom of the metagrammar (i.e., for each class name to be valuated), a list of description formulas per accumulator. These lists are grouped together into a tuple of lists of the following form (N is the number of dimensions, and consequently of accumulators): desc(accu1(L1),accu2(L2), ... ,accuN(LN))

Each element (i.e., list Li) of such a tuple is a complete description of a given dimension, where shared variables have been unified (via unification with backtracking).

Solving (tree) descriptions. As illustrated above, interpreting XMG's control language in terms of an EDCG yields tuples whose arity is the number of dimensions defined by the linguist, that is, triples of the form SY N, SEM, DY N if syntax, semantics and the dynamic interface are described.

For each dimension D, XMG includes a constraint solver S D which computes the set of minimal models M D = S D (d D ) satisfying the description (d D ) of that dimension. In other words, each dimension is interpreted separately by a specific solver. For instance, the syntactic dimension is handled by a tree description solver which produces, for a given tree description, the set of trees satisfying that description, while the solver for the semantic dimension simply outputs the flat semantic representation (list of semantic literals) built by the EDCG through accumulation.

Note that, while solvers are distinct, the models computed in each dimension may nonetheless be coupled through shared variables. In that case, these variables can constrain the models computed by the respective solvers. For instance, shared variables can be used for the syntactic tree description solver to be parametrized by some value coming from the semantic input description. Note that the output of the solving process is a Cartesian product of the sets of minimal models of each solver. As a consequence, the worst case complexity of metagrammar compilation is that of the various solvers associated with relevant dimensions.

In addition to having separate solvers for each dimension, the constraint solving approach used in XMG permits us to modularize a given solver by combining different principles. Each such principle enforces specific constraints on the models satisfying the description of a given dimension. For instance, for the syntactic dimension of an FB-LTAG, a set of principles is used to enforce that the structures produced by the compiler are trees, and that these conform to the FB-LTAG formalism (e.g., there is no tree having two foot nodes).

Architecture

The XMG compiler14 consists of the following three modules:

• A compiler that parses XMG's concrete syntax and compiles XMG classes into clauses of an Extended Definite Clause Grammar (EDCG).

• A virtual machine (VM), which interprets EDCG. This VM performs the accumulation of dimensions along with scope management and identifiers resolution. This VM is basically a unification engine equipped with backtracking, and which is extended to support EDCG. While its architecture is inspired by the Warren Abstract Machine (Aït-Kaci 1991), it uses structure sharing to represent and unify prolog terms, and given a query on a class, processes the conjunctions, disjunctions, inheritance and export statements related to that class to produce its full definition namely, a tree description for the SYN dimension, a flat semantic formula for the SEM dimension and a feature structure for the DYN dimension.

• A constraint solving phase which produces for each dimension, the minimal models satisfying the input description as unfolded by the preceding two steps.

As already mentioned, the first part is extensible in that new linguistic dimensions can be added by specifying additional dedicated accumulators to the underlying EDCG. The second part is a unification engine that interprets EDCG while performing both term unification and polarized unification (i.e., unification of polarized feature structures, as defined by [START_REF] Perrier | Interaction Grammars[END_REF], and discussed in Section 5.3.1). This extended unification is the reason why XMG does not merely recourse to an existing Prolog engine to process EDCG, but relies on a specific VM instead.

The third part is completely modular in that various constraint solvers can be plugged in depending on the requirements set by the dimensions used, and the chosen grammatical framework. For instance, the SYN dimension is solved in terms of tree models, while the SEM dimension is solved in terms of underspecified flat semantic formulae (i.e., the input semantics remains untouched modulo the unification of its shared variables).

Importantly, these additional solvers can be "turned on/off" (via a primitive of the XMG language) so that for instance, the same processor can be used to compile an XMG specification for an FB-LTAG using linguistic principles such as those defined in the next section (i.e., clitic ordering principle) or not.

Three extensions of XMG

We now show (i) how the modular architecture of the XMG compiler permits us to specify grammars for several tree based linguistic formalisms; (ii) how it can be extended to enforce language specific constraints on the syntactic trees; and (iii) how additional formal constraints (namely node marking) can be integrated to simplify node identifications (and consequently grammar writing).

5.

3.1 TAG, MC-TAG and IG: producing trees, tree sets or tree descriptions. XMG integrates a generic tree solver which computes minimal tree models from a tree description logic formulae built on the language SYN introduced in Section 4. This solver integrates the dominance solving technique proposed by [START_REF] Duchier | Dominance constraints with set operators[END_REF] and can be summarized as follows. A minimal tree model is described in terms of the relative positions of its nodes. For each node n in a minimal tree model T , the set of all the nodes of T can be partitioned in 5 subsets, depending on their position relatively to n. Hence, for each node variable n appearing in a tree description, it is first associated with an integer (called node id), we then define the 5 sets of node ids (i.e., sets of integers) Down n , Up n , Left n , Right n and Eq n referring to the ids of the nodes located below, above, on the left, on the right or identified with n respectively (see Figure 6). Note that we require that these sets are a partition of all node ids.

Eq

Up

Down

Left

Right

Figure 6

Partition of the nodes of tree models Using this set-based representation of a model, we translate each node relation from the input formula (built on the tree description language introduced in Section 4) into constraints on the sets of node ids that must hold in a valid model. For instance, the sub-formula n 1 ≺ + n 2 which states that node n 1 strictly precedes node n 2 is translated into:

n 1 ≺ + n 2 ≡ EqDown n 1 ⊆ Left n 2 ∧ EqDown n 2 ⊆ Right n 1 ∧ (24) Right n 2 ⊆ Right n 1 ∧ Left n 1 ⊆ Left n 2 (25)
where 15 EqDown x = Eq x ⊎ Down x for x ∈ {n 1 , n 2 }. In other words, in a valid minimal tree model, the set of nodes below or equal to n 1 is included in the set of nodes (strictly) on the left of n 2 , the set of nodes below or equal to n 2 is included in the set of nodes (strictly) on the right of n 1 , the set of nodes on the right of n 2 is included in the set of nodes on the right of n 1 and finally the set of nodes on the left of n 1 is included in the set of nodes on the left of n 2 . Once all input relations are translated into set constraints, the solver uses standard Constraint Satisfaction techniques (e.g., a first-fail exploration of the search tree) to find a set of consistent partitions. Finally, the nodes of the models are obtained by considering nodes with distinct Eq n .

FB-LTAG trees.

To support the specification of FB-LTAG trees, the XMG compiler extends the generic tree solver described above with a set of constraints ensuring that the trees are well-formed TAG trees. In effect, these constraints require the trees to be linear ordered trees with appropriate decorations. Each node must be labelled with a syntactic category. Leaf nodes are either terminal, foot or substitution nodes. There is at most one foot node per tree and the category of the foot node must be identical to that of the root node. Finally, each tree must have at least one leaf node which is an anchor. MCTAG tree sets. While FB-LTAG consists of trees, Multi-Component Tree-Adjoining Grammar (MC-TAG) [START_REF] Weir | Characterizing Mildly Context-Sensitive Grammar Formalisms[END_REF]) consists of sets of trees. To support the specification of MC-TAG, the sole extension needed concerns node variables that are not dominated by any other node variable in the tree description. Whilst for FB-LTAG, these are taken to denote either the same root node or nodes that are connected to some other node (i.e., uniqueness of the root), for MC-TAG they can be treated as distinct nodes thereby allowing for models that are sets of trees rather than trees [START_REF] Parmentier | SemTAG : une plate-forme pour le calcul sémantique à partir de Grammaires d'Arbres Adjoints[END_REF]). In other words, the only modification brought to the tree description solver is that, in MC-TAG mode, it does not enforce the uniqueness of a root node in a model.

IG polarized tree descriptions. Interaction Grammars [START_REF] Perrier | Interaction Grammars[END_REF] consist of tree descriptions whose node variables are labelled with polarized feature structures. A polarized feature structure is a set of polarized feature triples (f, p, v) where f and v are standard features and feature values respectively while p is a polarity value in {→, ←, =, ≈}. Polarities are used to guide parsing in that a valid derivation structure must neutralize polarities.

To support an XMG encoding of IG, two extensions are introduced namely (i) the ability to output tree descriptions rather than trees, and (ii) the ability to write polarized feature structures. The first extension is trivially realized by specifying a description solver which ensures that any output description has at least one tree model. For the second point, the SYN language is extended to define polarized feature structures and the unification engine to support unification of polarized features (for instance, a → feature will unify with a neutral (=) feature to yield a → polarized feature value triple).

Adding specific linguistic constraints: the case of clitics.

XMG can be extended to support specific constraints on tree descriptions (e.g., constraints on node linear order), which make it possible to describe linguistic-dependent phenomena, such as for instance clitic ordering in French, at a meta-level (i.e., within the metagrammar).

According to [START_REF] Perlmutter | Surface structure constraints in syntax[END_REF], clitics are subject to two hard constraints. First, they appear in front of the verb in a fixed order according to their rank 16 (26a-26b). Second, two different clitics in front of the verb cannot have the same rank (26c). To support a direct encoding of Perlmutter's observation, XMG includes both a node uniqueness principle and a node ordering principle. The latter allows us to label nodes with some property (let us call it rank) whose value is an integer (for instance, one can define a node as n 1 (rank : 2)[cat : Cl]). When solving tree descriptions, XMG further requires that in a valid tree model, (i) there are no two nodes with the same rank and (ii) sibling nodes labelled with a rank are linearly ordered according to their rank.

Accordingly, in the French grammar of Crabbé (2005), each node labelled with a clitic category is also labelled with a numerical node property representing its rank. 17 XMG ordering principle then ensures that the ill-formed tree crossed out in the Figure 7, is not produced. Note that in Figure 7, every type of clitic is defined locally (i.e., in a 16 The number on the clitics indicate their rank. 17 Recall that node properties are features whose values are used by the tree description solver in order to restrict the set of valid models. These properties may not appear in the trees produced from the input metagrammar. For instance, the rank property is not part of the FB-LTAG formalism, and thus does not appear in the FB-LTAG elementary trees produced by XMG.

separate class), and that the interactions between these local definitions are handled by XMG using this rank principle, to produce only one valid description (pictured on the right of the arrow).

S N↓ ≺ + V' ∧ V' Cl↓ 3 ≺ + V ∧ V' Cl↓ 4 ≺ + V ∧ S V' V⋄ ⇒ S N↓ V' Cl↓ 3 Cl↓ 4 V⋄ S N↓ V' Cl↓ 4 Cl↓ 3 V⋄ Figure 7 Clitic ordering in French
That is, XMG ordering constraints permit a simple, declarative, encoding of the interaction between clitics. This again contrasts with systems based on lexical rules. As noted by [START_REF] Perlmutter | Surface structure constraints in syntax[END_REF], if clitics are assumed to be moved by transformations, then the order in which lexical rules apply this movement must be specified.

To implement the uniqueness principle, one needs to express the fact that in a valid model φ, there is only one node having a given property p (i.e., a parameter of the constraint, here the value of the rank node property). This can be done by introducing, for each node n of the description, a Boolean variable p n indicating whether the node denoting n in the model has this property or not (i.e., are there two nodes of identical rank ?). Then, if we call V φ p the set of integers referring to nodes having the property p in a model, we have: p n ≡ (Eq n ∩ V φ p ) = ∅ . Finally, if we represent p n being with 1 and p n being false with 0,18 and we sum the p n for each n in the model, we have that in a valid model, this sum is strictly lower than 2: n∈φ p n < 2 . To implement the ordering principle, one needs to express the fact that in a valid model φ, two sibling nodes n 1 and n 2 having a given property p of type integer and of values p 1 and p 2 respectively, are such that the linear precedence between these nodes conform to the natural order between p 1 and p 2 . This can be done, by first introducing, for each pair of nodes n, m of the description, a Boolean variable b n,m indicating whether they have the same ancestors: b n,m ≡ (Up n ∩ Up m ) = (Up n ∪ Up m ) . For each pair of nodes that do so, we check whether they both have the property p, and if this is case, we add to the input description, a strict precedence constraint on these nodes according to their respective values of the p property:

19 b n,m ∧ (p n < p m ) ⇒ n ≺ + m (27) b n,m ∧ (p m < p n ) ⇒ m ≺ + n (28)

Adding color constraints to facilitate grammar writing.

To further ease grammar development, XMG supports a node coloring mechanism that permits nameless node identification [START_REF] Crabbé | Metagrammar redux[END_REF], reminiscent of the polarity-based node identification first proposed in Muskens and Krahmer (1998) and later used by Duchier andThater (1999), Perrier (2000). Such a mechanism offers an alternative to explicit node identification using equations between node variables. The idea is to label node variables with a color property, whose value (either red, black or white) can trigger node identifications. This mechanism is another parameter of the tree solver. When in use, the valid tree models must satisfy some color constraints, namely they must only have red or black nodes (no remaining white nodes, these have to be identified with some black node). As shown in the table below, node identification must observe the following constraints: a white node must be identified with a black node; a red node cannot be identified with any other node; and a black node may be identified with one or more white nodes.20

• B • R • W ⊥ • B ⊥ ⊥ • B ⊥ • R ⊥ ⊥ ⊥ ⊥ • W • B ⊥ • W ⊥ ⊥ ⊥ ⊥ ⊥ ⊥
We now briefly describe how the constraint solver sketched in Section 5.3.1 was extended to support colors. As mentioned above, in valid models, all the white nodes are identified with a black node. Consequently, there is a bijection from the red and black nodes of the tree description to the nodes of the model. In order to take this bijection into account, we add a node variable RB n to the 5 sets already associated with a node variable n from section 5.1. RB n denotes either n if n is a black or red node, or the black node identified with n if n is a white node. Note that all the node variables must be colored: the set of node variables in a tree description can then be partitioned into 3 sets Red, Black and W hite. Basically, we know that, for all node n, RB n ∈ Eq n (this is what the bijection is about). Again we translate color information into constraints on node sets (these constraints help the generic tree solver by reducing the ambiguity for the Eq n sets):

n ∈ Red ⇒ (n = RB n ) ∧ (Eq n = {n}) (29) n ∈ Black ⇒ (n = RB n ) ∧ (Eq n \{n} ⊆ W hite) (30) n ∈ W hite ⇒ (RB n ∈ Black) ∧ (Eq n ∩ Black = {RB n }) (31)
Node coloring offers an alternative to complex namespace management. The main advantage of this particular identification mechanism is its economy: not only is there no longer any need to remember node identifiers, there is in fact no need to choose a name for node variables.

It is worth stressing that the XMG node identification process is reduced to a constraint solving problem and so it is not a sequential process. Thus the criticisms levelled by Cohen-Sygal andWintner (2007, 2009) against non associative constraints on node unification do not apply.

Briefly, in their work, Cohen-Sygal andWintner (2007, 2009) showed that any polarity-based tree description formalism is not associative. In other words, when describing trees in terms of combinations of polarized structures, the order in which the structures are combined matters (i.e., the output structures depend on the combination order). This feature makes such formalisms not appropriate for a modular and collaborative grammar engineering, such as that of Cohen-Sygal and Wintner (2011) for Unification Grammar.

In the XMG case, when using node colors, the tree description solver does not rely on any specific fragment combination order. It computes all possible combination orders. In this context, the grammar designer cannot think in terms of sequences of node identifications. This would lead to tree overgeneration.

Again, it is important to remember that tree solving computes any valid tree model, independently of any specific sequence of node identifications (all valid node identifications are computed). In this context, non associativity of color-based node identification is not an issue, but rather a feature, as it allows for a compact description of a large number of node identifications (and thus of tree structures).

Writing Grammars with XMG

In this section, we first provide a detailed example showing how XMG can be used to specify the verbal trees of a large FB-LTAG for French extended with a unification based semantics. We then give a brief description of several large and middle scale grammars that were implemented using XMG.

SEMTAG: a large FB-LTAG for French covering syntax and semantics

We now outline the XMG specification for the verbal trees of SEMTAG, a large FB-LTAG for French. This specification further illustrates how the various features of XMG (e.g., combined use of disjunction and conjunction, node colors) permit us to specify compact and declarative grammar descriptions. We first discuss the syntactic dimension (SYN). We then go on to show how the semantic dimension (SEM) and the syntax/semantic interface (DYN) are specified.

The syntactic dimension.

The methodology used to implement the verbal fragment of SEMTAG can be summarized as follows. First, tree fragments are defined which represent either a possible realization of a verb argument or a possible realization of the verb. The verbal elementary TAG trees of SEMTAG are then defined by appropriately combining these tree fragments.

To maximize structure sharing, we work with four levels of abstraction. First, basic tree fragments describing verb or verb argument realizations are defined. Second, grammatical functions are defined as disjunctions of argument realizations. Third, verbal diathesis alternatives are defined as conjunctions of verb realizations and grammatical functions. Fourth, diathesis are gathered into tree families. In the next paragraphs, we explain each of these levels in more details.

Tree fragments. Tree fragments are the basic building blocks used to define SEMTAG. These are the units that are shared and reused in the definition of many elementary trees. For instance, the fragment for a canonical subject will be used by all FB-LTAG elementary trees involving a canonical subject.

As mentioned above, to specify the verbal elementary trees of SEMTAG, we begin by defining tree fragments which describe the possible syntactic realizations of the verb arguments and of the verb itself. Figure 8 provides some illustrative examples of these fragments. Here and in the sequel, we omit the feature structures decorating the trees to facilitate reading. 21

CanonSubj

→ S• W N↓• R V• W CanonObj → S• W V• W N↓• R CanonIndirObj → S• W V• W PP• R P• R à• R N↓• R CanonByObj → S• W V• W PP• R P• R par• R N↓• R RelatSubj → N• R N⋆• R S• W N↓• R V• W WhObj → S• R N↓• R S• W V• W WhByObj → S• R PP• R P• R par• R N↓• R S• W WhIndirObj → S• R PP• R P• R à• R N↓• R S• W ActiveVerbForm→ S• B V⋄• B PassiveVerbForm→ S• B V• B V↓• B V⋄• B

Figure 8

Elementary tree fragments used as building blocks of the grammar (nodes are colored to control their identification when blocks are combined)

To further factorize information and facilitate grammar maintenance, the basic tree fragments are organized in an inheritance hierarchy. 22 Figure 9 shows a partial view of this hierarchy illustrating how the tree fragments for argument realization depicted in Figure 8 are organized to maximize the sharing of common information. The hierarchy classifies the verbal arguments depicted in Figure 8 into four categories:

1. The canonical subject is a noun realized in front of the verb.

2. Canonical complements occur after the verb. The canonical object is a noun phrase whereas prepositional complements are introduced by specific prepositions namely, à for the canonical indirect object and par for the canonical by object.

3. Wh-arguments (or questioned arguments) occur in front of a sentence headed by a verb. A Wh-object is an extracted noun whilst questioned prepositional objects are extracted prepositional phrases that are introduced by a specific preposition.

4. Finally, the relativized subject is a relative pronoun realized in front of the sentence. Extracted subjects in French cannot be realized at an unbounded distance of the predicate. Syntactic functions. The second level of abstraction uses syntactic function names such as Subject and Object to group together alternative ways in which a given syntactic function can be realized. For instance, if we make the simplifying assumption that the possible argument realizations are limited to those given in Figure 8, the Subject, Object, ByObject and IndirectObject classes would be defined as follows. 23Subject → CanonSubj ∨ RelatSubj (32)

VerbalArgument

Object → CanonObj ∨ W hObj (33) ByObject → CanonByObj ∨ W hByObj (34) IndirectObject → CanonIndirObj ∨ W hIndirObj (35)
That is, we define the Subject class as an abstraction for talking about the set of tree fragments that represent the possible realizations of a subject argument namely, in our restricted example, canonical and relativized subject. Thus, the simplified Subject class defined above characterizes contexts such as the following :

(36) a. Jean mange.

(canonical subject) 'John eats.' b. Le garçon qui mange (relativized subject) 'The boy who eats' Similarly, the IndirectObject class abstracts over the realization of an argument introduced by the preposition à to the right of the verb (CanonIndirObj) or realized in extracted position (possibly realized at an unbounded distance from the predicate) as illustrated by the following examples :

(37) a. Jean parle à Marie.

(canonical indirect object) 'John talks to Mary.' b. À qui Jean parle-t-il ?

(wh indirect object) 'To whom is John talking ?' c. À qui Pierre croit-il que Jean parle ?

(wh indirect object) 'To whom Peter thinks that John talks ?' This way of grouping tree fragments is reminiscent of the informal classification of French syntactic functions presented by [START_REF] Iordanskaja | Establishing an Inventory of Surface -Syntactic Relations: Valence -controlled Surface -dependents of the Verb in French[END_REF] whereby each syntactic function is associated with a set of possible syntactic constructions.

Diathesis alternations. In this third level, we take advantage of the abstractions defined in the previous level to represent diathesis alternations. Again we are interested here in describing alternatives. Diathesis alternations are those alternations of mapping between arguments and syntactic functions such as for instance the active/passive alternation. In a diathesis alternation, the actual form of the verb constrains the way predicate arguments are realized in syntax. Thus, in the following example, it is considered that both (38a) and (38b) are alternative realizations of a predicate argument structure such as send(John, a letter).

(38) a. Jean envoie une lettre.

'John sends a letter.' b. Une lettre est envoyée par Jean.

'A letter is sent by John.'

The active/passive diathesis alternation captures the fact that if the verb is in the active form, its two arguments are realized by a subject and an object whereas if the verb is in the passive form, then the arguments consist of a subject and a by-object.

T ransitiveDiathesis → (Subject ∧ ActiveV erbF orm ∧ Object)

∨ (Subject ∧ P assiveV erbF orm ∧ ByObject) (39)
Finally a traditional case of "erasing"24 , such as the agentless passive (or passive without agent) can be expressed in our language by adding an additional alternative where the By Object or agentive complement is not expressed. Thus ( 40) is an augmentation of (39) where we have added the agentless passive alternative (indicated in bold face).

T ransitiveDiathesis → (Subject ∧ ActiveV erbF orm ∧ Object)

∨ (Subject ∧ P assiveV erbF orm ∧ ByObject) ∨ (Subject ∧ PassiveVerbForm) (40)
This methodology can be further augmented to implement an actual linking in line of [START_REF] Bresnan | Deep unaccusitivity in LFG[END_REF]. For the so-called erasing cases, one can map the "erased" predicative argument to an empty realization in syntax. We refer the reader to (Crabbé 2005) for further details.

Tree Finally, tree families are defined that is, sets of trees capturing alternative realizations of a given verb type (i.e., sub-categorization frame). Continuing with the simplified example presented so far, we can for instance define the tree family for verbs taking a nominal subject, a nominal object and an indirect nominal object (i.e., ditransitive verbs) as follows :

DitransitiveF amily → T ransitiveDiathesis ∧ Indirectobject (41)

The trees generated for such a family will, among others, handle the following contexts:25

(42) a. Jean offre des fleurs à Marie. 'John offers flowers to Mary.' b. À quelle fille Jean offre-t-il des fleurs ? 'To which girl does John offer flowers ?' c. Le garçon qui offre des fleurs à Marie.

'The boy who offers flowers to Mary.' d. Quelles fleurs le garçon offre-t-il à Marie ?

'Which flowers does the boy offer to Mary ?' e. Les fleurs sont offertes par Jean à Marie.

'The flowers are offered by John to Mary.' f. Par quel garçon les fleurs sont-elles offertes à Marie ?

'By which boy the flowers are offered to Mary.'

It is straightforward to extend the grammar with new families. Thus, for instance (43) shows how to define the transitive family (for verbs taking a nominal subject and a nominal object) and ( 44), the intransitive one (alternatives of a verb sub-categorizing for a nominal subject).

T ransitiveF amily → T ransitiveDiathesis

(43)

IntransitiveF amily → Subject ∧ ActiveV erbF orm (44)
Similarly, tree families for non verbal predicates (adjectives, nouns) can be defined using the abstraction over grammatical functions defined for verbs. For instance, the examples in (45a-45b) can be captured using the adjectival trees defined in ( 47) and ( 48) respectively where Subject extends the definition of subject given above with a Whsubject, PredAdj combines a subject tree fragment with a tree fragment describing a predicative adjective and PredAdjAObj extends a PredAdj tree fragment with a canonical à-object.

(45) a. Jean est attentif, Qui est attentif?, L'homme qui est attentif.

'John is mindful, Who is mindful?, The man who is mindful.' b. Jean est attentif à Marie, Qui est attentif à Marie?, L'homme qui est attentif à Marie.

'John is mindful of Mary, Who is mindful of Mary?, The man who is mindful of Mary.'

Subject → CanonSubj ∨ RelatSubj ∨ W hSubj (46)
P redAdj → Subject ∧ AdjectivalF orm (47)
P redAdjAObj → P redAdj ∧ CanonAObj (48)

6.1.2 The semantic dimension and the Syntax / Semantic Interface. We now show how to extend the XMG specification presented in the previous section to integrate a unification-based compositional semantics. Three main changes need to be carried out:

1. Each elementary tree must be associated with a semantic formula. This is done using the SEM dimension.

2. The nodes of elementary trees must be labelled with the appropriate semantic indices. This involves introducing the correct attribute-value pair in the correct feature structure (top or bottom) on the appropriate node.

3. Syntax and semantics need to be synchronized that is, variable sharing between semantic formulae and tree indices need to be enforced. To this end we use the DYN dimension.

Informing the Semantic Dimension. To associate each elementary tree with a formula representing the meaning of the words potentially anchoring that tree, we use the SEM dimension to specify a semantic schema. For instance, the TransitiveFamily class defined in (43) for verbs taking two nominal arguments is extended as follows :

T ransitiveF amily → T ransitiveDiathesis ∧ BinaryRel ( 49
)
where TransitiveDiathesis is the XMG class defined in (40) to describe the set of trees associated with transitive verbs and BinaryRel the class describing the following semantic schema :

L : P (E) ∧ L : T heta 1 (E, X) ∧ L : T heta 2 (E, Y ) (50)
In this semantic schema, P , T heta 1 and T heta 2 are unification variables that become ground when the tree is anchored with a specific word. For instance, P , T heta 1 and T heta 2 are instantiated to eat, agent and patient respectively when the anchor is ate (these pieces of information -predicate, thematic roles -are associated with lemmas, located in the syntactic lexicon, and unified with adequate semantic variables via anchoring equations). Further, X, Y, E, L are unification variables representing semantic arguments. As illustrated in Figure 3, these become ground during (or after) derivation as a side effect of the substitutions and adjunctions taking place when trees are combined. It is worth noting that by combining semantic schemas with diathesis classes, one such specification assigns the specified semantic schema to many trees namely, all the trees described by the corresponding diathesis class. In this way, the assignment of semantic formulae to trees is relatively economical. Indeed in SEMTAG, roughly 6,000 trees are assigned a semantic schema using a total of 75 schema calls.

Co-indexing and Formulae Indices. Assuming that tree nodes are appropriately decorated with semantic indices by the specification scheme described in the next paragraph, we now show how to enforce the correct mapping between syntactic and semantic arguments. This is done in two steps. First, we define a set of interface constraints of the form index F : V, arg i : V which are used to enforce the identification of the semantic index (index F ) labelling a given tree node with grammatical function F (e.g., F := subject) with the index (arg i ) representing the i-th argument in a semantic schema. For instance, the following constraints ensure a subject/arg 1 mapping that is, a coreference between the index labelling a subject node and the index representing the first argument of a semantic schema:

C 1 → N ode [idx : I] ∧ index subject : I C 2 → L : P (E) ∧ L : T heta 1 (E, X) ∧ arg 1 : X SubjectArg 1 → C 1 ∧ C 2 ∧ index subject : V, arg 1 : V (51)
Given such interface constraints, we refine the diathesis definitions so as to ensure the correct bindings. For instance, the specification in ( 39) is modified to:

T ransitiveActive → (SubjectArg 1 ∧ ObjectArg 2 ∧ Subject ∧ ActiveV erbF orm ∧ Object) (52)
whilst the passive diathesis is specified as:

T ransitiveP assive → (SubjectArg 2 ∧ ByObjectArg 1 ∧ Subject ∧ P assiveV erbF orm ∧ ByObject) (53)
Labelling Tree Nodes with Semantic Indices. The above scheme relies on the assumption that tree nodes are appropriately labelled with semantic indices (e.g., the subject node must be labelled with a semantic index) and that these indices are appropriately named (arg 1 must denote the parameter representing the first argument of a binary relation and index subject the value of the index feature on a subject node). As suggested by [START_REF] Gardent | Tree Adjoining Grammar, Semantic Calculi and Labelling Invariants[END_REF], a complete semantic labelling of a TAG with the semantic features necessary to enrich this TAG with the unification based compositional semantics sketched above can be obtained by applying the following labelling principles26 :

Argument labelling: In trees associated with semantic functors, each argument node is labelled with a semantic index27 named after the grammatical function of the argument node (e.g., index subject for a subject node). Controller/Controllee: In trees associated with control verbs, the semantic index of the controller is identified with the value of the controlled index occurring on the sentential argument node. Anchor projection: The anchor node projects its index up to its maximal projection.

Foot projection: A foot node projects its index up to the root. 28As we shall now see, XMG permits a fairly direct encoding of these principles.

The Argument Labelling principle states that, in the tree associated with a syntactic functor (e.g., a verb), each node representing a syntactic argument (e.g., the subject node) should be labelled with a semantic index named after the grammatical function of that node (e.g., index subject ). 29To specify this labelling, we define for each grammatical function F unction ∈ {Subject, Object, ByObject, IndirectObject, . . . }, a semantic class F unctionSem which associates with an (exported) node variable called F unctionN ode the feature value pair Additionally, in the tree fragments describing the possible realizations of the grammatical functions, the (exported) variable denoting the argument node is systematically named ArgN ode.

Finally, we modify the specification of the realizations of the grammatical functions to import the appropriate semantic class and identify ArgN ode and F unctionN ode. For instance, the Subject specification given above is changed to :

Subject → SubjectSem ∧ ArgN ode = SubjectN ode ∧ (CanonSubj ∨ RelatSubj ∨ W hSubj) (55)
As a result, all ArgN ode nodes in the tree descriptions associated with a subject realization are labelled with an index feature I whose global name is index subject .

Value sharing between the semantic index of the controller (e.g., the subject of the control verb) and that of the controllee (e.g., the empty subject of the infinitival complement) is enforced using linking constraints between the semantic index labelling the controller node and that labelling the sentential argument node of the control verb. Control verb definitions then import the appropriate (object or subject control) linking constraint.

The anchor (resp. foot) projection principle stipulates the projection of semantic indices from the anchor (resp. foot) node up to the maximal projection (resp. root). Concretely, this means that the top and bottom features of the nodes located on this path between the anchor (resp. foot) and the maximal projection (resp. root) all include an index feature whose value is shared between adjacent nodes (see variables E i in Figure 10) 30 . Once the top and bottom structures are unified, so are the semantic indices along this path (modulo expected adjunctions realized on the projection).

To these principles, we define a set of anchor projection classes {Depth1, Depth2, Depth3} as illustrated in Figure 10. We then "glue" these projection skeletons onto the relevant syntactic trees by importing the skeletons in the syntactic tree description and explicitly identifying the anchor node of the semantic projection classes with the anchor or foot node of these syntactic tree descriptions. Since the models must be trees, the nodes dominating the anchor node of the projection class will deterministically be identified with those dominating the anchor or foot node of the trees being combined with. For instance, for verbs, the class specifying the verbal spine (e.g., ActiveVerbForm, see Figure 10) equates the anchor node of the verbal spine with that of the projection skeleton. As a result, the verb projects its index up to the root.

E3 E2 E2 E1 E2 E1 E1 E E1 E E1 E E E E Depth 3 Depth 2 Depth 1 S E2 E1 VP E1 E V E

ActiveVerbForm

Figure 10

Anchor/Foot projection.

6.1.3 Some figures about SEMTAG. As mentioned above, SEMTAG is a large FB-LTAG for French equipped with semantics [START_REF] Gardent | Integrating a unification-based semantics in a large scale Lexicalised Tree Adjoininig Grammar for French[END_REF], it extends the purely syntactic FTAG of Crabbé (2005) with a unification based compositional semantics as described by [START_REF] Gardent | Semantic Construction in Feature-Based Tree Adjoining Grammar[END_REF]. 31 The syntactic FTAG in essence implements [START_REF] Abeillé | Une grammaire électronique du français[END_REF]'s proposal for an FB-LTAG-based modelling of French syntax. FTAG contains around 6,000 elementary trees built from 293 XMG classes and covers some 40 basic verbal sub-categorization frames. For each of these frames, FTAG defines a set of argument alternations (active, passive, middle, neuter, reflexivization, impersonal, passive impersonal) and of argument realizations (cliticization, extraction, omission, permutations, etc.) possible for this frame. Predicative (adjectival, nominal and prepositional) and light verb constructions are also covered as well as some common sub-categorizing noun and adjective constructions. Basic descriptions are provided for the remaining constructions namely, adverbs, determiners and prepositions. FTAG and SEMTAG were both evaluated on the Test Suite for Natural Language Processing (TSNLP) [START_REF] Lehmann | TSNLP -Test Suites for Natural Language Processing[END_REF], using a lexicon designed specifically on the test suite, hence reducing lexical ambiguity (Crabbé 2005;Parmentier 2007). This test suite focuses on difficult syntactical phenomena, providing grammatical and ungrammatical sentences. These competence grammars accept 76 % of the grammatical items, reject 83% of the ungrammatical items and have an average ambiguity of 1.64 parses per sentence. To give an idea of the compilation time, under architectures made of a 2 Ghz processor with 1 Gb of RAM, it takes XMG 10 minutes to compile the whole SEMTAG (recall that there is no semantic description solving, hence the compilation times between FTAG and SEMTAG do not differ). 32Note that SEMTAG can be used for assigning semantic representations to sentences when combined with an FB-LTAG parser and a semantic construction module as described by Gardent andParmentier (2005, 2007). 33 Conversely, it can be used to verbalize the meaning denoted by a given semantic representation when coupled with the GenI surface realizer described by [START_REF] Gardent | A symbolic approach to Near-Deterministic Surface Realisation using Tree Adjoining Grammar[END_REF].

Other grammars designed with XMG

XMG has been used mainly to design FB-LTAG and IG for French or English. More recently, it has also been used to design a FB-LTAG for Vietnamese and a TT-MCTAG for German. We now briefly describe each of these resources.

SemXTAG. The English grammar, SEMXTAG [START_REF] Alahverdzhieva | XTAG using XMG[END_REF], reimplements the FB-LTAG developed for English at the University of Pennsylvania (XTAG Research Group 2001) and extends it with a unification based semantics. It contains 1,017 trees and covers the syntactic fragment of XTAG namely auxiliaries, copula, raising and small clause constructions, topicalization, relative clauses, infinitives, gerunds, passives, adjuncts, ditransitives (and datives), ergatives, it-clefts, wh-clefts, PRO constructions, noun-noun modification, extraposition, determiner sequences, genitives, negation, noun-verb contractions, sentential adjuncts, imperatives and resultatives. The grammar was tested on a handbuilt test-suite of 998 sentences illustrating the various syntactic constructions meant to be covered by the grammar. All sentences in the testsuite can be parsed using the grammar.

FrenchIG. The extended XMG framework was used to design a core IG for French consisting of 2,059 tree descriptions compiled out of 448 classes [START_REF] Perrier | A French Interaction Grammar[END_REF]. The resulting grammar is lexicalised, and its coverage was evaluated using the previously mentioned TSNLP. The French IG accepts 88% of the grammatical sentences and rejects 85% of the ungrammatical sentences, although the current version of the French IG does not yet cover all the syntactic phenomena presented in the test suite (for example, causative and superlative constructions).

Vietnamese TAG. The XMG language was used by [START_REF] Hong | A metagrammar for Vietnamese[END_REF] to produce a core FB-LTAG for Vietnamese. Their work is rather a proof of concept than a large-scale implementation. They focused on Vietnamese's categorization frames, and were able to produce a TAG covering the following frames: intransitive (tree family N0V), transitive with a nominal complement (N0VN1), transitive with a clausal complement (N0VS1), transitive with modal complement (N0V0V1), ditransitive (N0VN1N2), ditransitive with a preposition (N0VN1ON2), ditransitive with a verbal complement (N0V0N1V1), ditransitive with an adjectival complement (N0VN1A), movement verbs with a nominal complement (N0V0V1N1), movement verbs with an adjectival complement (N0V0AV1), and movement ditransitive (N0V0N1V1N2).

GerTT. XMG-based grammar corresponds to the German MC-TAG of Kallmeyer et al. (2008). This grammar, called GerTT, is in fact an MC-TAG with Tree Tuples [START_REF] Lichte | An MCTAG with Tuples for Coherent Constructions in German[END_REF]. This variant of MCTAG has been designed to model free word order phenomena. This is done by imposing node sharing constraints on MCTAG derivations [START_REF] Kallmeyer | Tree-Local Multicomponent Tree-Adjoining Grammars with Shared Nodes[END_REF]. GerTT covers phenomena such as scrambling, coherent constructions, relative clauses, embedded questions, copula verbs, complementized sentences, verbs with various sub-categorization frames, nouns, prepositions, determiners, adjectives, and partly includes semantics. It is made of 103 tree tuples, compiled from 109 classes.

Related Work

We now compare XMG with existing environments for designing tree-based grammars and briefly report on the grammars designed with these systems.

Environments for designing tree-based grammars

Candito's metagrammar compiler. The concept of metagrammar was introduced by Candito (1996). In her paper, Candito presented a compiler for abstract specifications of FB-LTAG trees (the so-called metagrammars). Such specifications are based on three dimensions, each of them being encoded in a separate inheritance hierarchy of linguistic descriptions. The first dimension describes canonical sub-categorization frames (e.g., transitive), the second redistributions of syntactic functions (e.g., active to passive), and the third the tree descriptions corresponding to the realizations of the syntactic functions defined in dimension 2. This three-dimensional metagrammatical description is then processed by a compiler to compute FB-LTAG tree schemas. In essence, these tree schemas are produced by associating a canonical sub-categorization frame (dimension 1) with a compatible redistribution schema (dimension 2), and with exactly one function realization (dimension 3) for each function required by the sub-categorization frame.

Candito's approach improves on previous proposals by Vijay-Shanker and Schabes (1992), [START_REF] Evans | Encoding lexicalized tree adjoining grammars with a nonmonotonic inheritance hierarchy[END_REF], in that it provides a linguistically principled basis for structuring the inheritance hierarchy. As shown in Section 6.1, the XMG definition of SEMTAG uses similar principles. Candito's approach differs however from the XMG account in several important ways:

• Much of the linguistic knowledge used to determine which classes to combine is hard-coded in the compiler (unlike in XMG, there is no explicit control on class combinations). In other words, there is no clear separation between the linguistic knowledge needed to specify a high-level FB-LTAG description and the algorithm used to compile an actual FB-LTAG from this description. This makes grammar extension and maintenance by linguists extremely difficult.

• As in [START_REF] Vijay-Shanker | Structure sharing in lexicalized tree adjoining grammars[END_REF][START_REF] Evans | Encoding lexicalized tree adjoining grammars with a nonmonotonic inheritance hierarchy[END_REF], the linguistic description is non monotonic in that some erasing classes are used to remove information introduced by other dimensions (e.g., agentless passive).

• The approach fails to provide an easy means to state exceptions. These are usually encoded in the compiling algorithm.

• The tree description language used to specify classes in dimension 3 relies on global node variables. Thus, two variables with identical names introduced in different classes are expected to refer to the same tree node. As argued in Section 4, this makes it hard to design large-scale metagrammars.

The LexOrg system. An approach similar to Candito's was presented by [START_REF] Xia | Consistent Grammar Development Using Partial-Tree Descriptions for LTAGs[END_REF], [START_REF] Xia | Automatic Grammar Generation from two Different Perspectives[END_REF], Xia, Palmer, andVijay-Shanker (2005, 2010). As in Candito's approach, a TAG abstract specification relies on a three-dimensional description made of namely, sub-categorization frames, blocks and lexical redistribution rules. To compile this specification into a TAG, the system selects a canonical sub-categorization frame, applies some lexical redistribution rules to derive new frames and finally select blocks corresponding to the resulting frames. These blocks contains tree descriptions using the logic of [START_REF] Rogers | Obtaining trees from their descriptions: An application to tree-adjoining grammars[END_REF].

LexOrg suffers from similar limitations as Candito's compiler. Much of the linguistic knowledge is embedded in the compiling algorithm making it difficult for linguists to extend the grammar description and to handle exceptions. Unlike in Candito's framework, the tree description language uses local node variables and let the tree description solver determine node identifications. Although this avoids having to memorize node names, this requires that the descriptions be constrained enough to impose the required node identifications and prevent the unwanted ones. In practice, this again complicates grammar writing. In contrast, XMG provides an intermediate solution which, by combining local variables with export declarations, avoids having to memorize too many node variable names (only those local to the relevant sub-hierarchy need memorizing) while permitting explicit node identification.

The metagrammar compiler of [START_REF] Gaiffe | A new metagrammar compiler[END_REF] proposed a compiler for FB-LTAG that aims to remedy both the lack of a clear separation between linguistic information and compilation algorithm, and the lack of explicit control on the class combinations prevalent in [START_REF] Candito | A principle-based hierarchical representation of LTAGs[END_REF][START_REF] Xia | Consistent Grammar Development Using Partial-Tree Descriptions for LTAGs[END_REF][START_REF] Xia | Automatic Grammar Generation from two Different Perspectives[END_REF]. In their approach, the linguistic specification consists of a single inheritance hierarchy of classes, each class containing a tree description. The description logic used is similar to Candito's. That is, global node names are used. To trigger class combinations, classes are labelled with two types of information: needs and resources. The compiler selects all final classes of the hierarchy, performs all possible combinations and only keeps these combinations that neutralize the stated needs and resources. The tree descriptions contained in these neutral combinations are then solved to produce the expected trees.

While this approach implements a clear separation between linguistic information and compilation algorithm, the fully automatic derivation of FB-LTAG trees from the inheritance hierarchy makes it difficult in practice to control overgeneration. In contrast, XMG's explicit definitions of class combinations by conjunction, disjunction and inheritance makes it easier to control the tree set that will be generated by the compiler from the grammar specification. Additionally, the issues raised by global variables remain (no way to instantiate twice a given class, and cumbersome definition of variables in large metagrammar).

The MGCOMP system. More recently, Villemonte de la [START_REF] De | DyALog: a tabular logic programming based environment for NLP[END_REF][START_REF] Villemonte De La Clergerie | Building factorized TAGs with meta-grammars[END_REF] proposed a compiler for FB-LTAG which aims at preserving a high degree of factorization in both the abstract grammar specification and the grammar which is compiled from it. Thus, the MGCOMP system does not compute FB-LTAG elementary trees, but factorized trees.

In MGCOMP, like in [START_REF] Gaiffe | A new metagrammar compiler[END_REF]'s approach, a metagrammar consists of a single hierarchy of classes. The classes are labelled with needs and resources, and final classes of the hierarchy are combined to compute tree descriptions. The main differences with [START_REF] Gaiffe | A new metagrammar compiler[END_REF], lies in the fact that (i) a description can include new factorizing operators, such as repetition (Kleene-star operator), shuffling (interleaving of nodes), optionality and disjunctions, and (ii) it offers namespaces specify the scope of variables. MGCOMP's extended tree descriptions are not completely solved by the compiler. Rather, it compiles underspecified trees (also called factorized trees). With this approach, a large grammar is much smaller in terms of number of grammatical structures, than a classical FB-LTAG. As a result, the grammars it compiles are only compatible with the DyALog parsing environment (Villemonte de La Clergerie 2005). And, since the linguist designs factorized trees and not actual TAG trees, debugging the metagrammar becomes harder.

Resources built using Candito, Xia and De La Clergerie's systems

Candito's system has been used by [START_REF] Abeillé | Ftag: current status and parsing scheme[END_REF] herself to design a core FB-LTAG for French and Italian, and later by [START_REF] Barrier | Une métagrammaire pour les noms prédicatifs du français : développement et expérimentations pour les grammaires TAG[END_REF] to design a FB-LTAG for adjectives in French. Xia's system (LexOrg) has been used to semi-automatically generate XTAG [START_REF] Xia | Automatic Grammar Generation from two Different Perspectives[END_REF]. De La Clergerie's system (MGCOMP) has been used to design a grammar for French named FRMG (FRench MetaGrammar) (Villemonte de la Clergerie 2010). FRMG makes use of MGCOMP's factorizing operators (e.g., shuffling operator), thus producing not sensu stricto a FB-LTAG, but a factorized FB-LTAG. FRMG is freely available, contains 207 factorized trees (e.g., having optional branches, etc.) built from 279 metagrammatical classes, and covers 95% of the TSNLP.

Conclusion

In this article, we presented the eXtensible MetaGrammar framework and argued that, contrary to other existing grammar writing environments for tree-based grammar, XMG is declarative, extensible and notationally expressive. We believe that these features make XMG particularly appropriate for a fast prototyping of the kind of deep tree-based grammars that are used in applications requiring high precision in grammar modelling (e.g., language teaching, man/machine dialogue systems, data-to-text generation).

The XMG language is documented on-line, its compiler is open source software, freely available under the terms of the GPL-compliant CeCILL license. 34 Many grammars designed with XMG (FB-LTAG and IG for French and English, TT-MCTAG for German) are also open-source and available on-line. 35Future research will focus on extensibility. So far, XMG has been used to design treebased grammars for different languages. We plan to extend XMG to handle other types of formalisms36 such as dependency grammars, and to support dimensions other than syntax and semantics such as for instance, phonology or morphology. As mentioned in the article, XMG offers a modular architecture, making it possible to extend it relatively easily. Nonetheless, in its current state, such extensions imply modifying XMG's code. We are exploring new extensions of the formalism, which would allow the linguist to dynamically define her/his metagrammar formalism (e.g., which principles or descriptions to use) depending on the target formalism.

Another interesting question concerns cross-language grammar engineering. So far, the metagrammar allows for dealing with structural redundancy. As pointed out by [START_REF] Kinyon | The metagrammar goes multilingual: A cross-linguistic look at the v2-phenomenon[END_REF], a metagrammar can be used to capture generalizations across languages and is surely worth further investigating.

Finally, we plan to extend XMG with features borrowed from Integrated Development Environments (IDE) for programming languages. Designing a grammar is, in some respect, similar to programming an application. Grammar environments should benefit from the same tools as those used for the development of applications (e.g., incremental compilation, debugger, etc.).

Figure 1

 1 Figure 1Sample derivation of Marie a vu Jean 'Mary has seen John' in a TAG

  Program XMG Metagrammar Clause ::= Head → Body Body ::= F act | Head | Body ∨ Body | Body ∧ Body Query ::= Head Class ::= N ame → Content Content ::= Description | N ame | Content ∨ Content | Content ∧ Content Axiom ::= N ame

(

  26) a. Jean le 3 lui 4 donne. 'John gives it to him.' b. *Jean lui 4 le 3 donne. *'John gives to him it.' c. *Jean le 3 la 3 donne. *'John gives it it.'

  Figure 9Organization of elementary fragments in an inheritance hierarchy

  [index : I] and a DYN constraint of the form index F unction : I . For instance, the class SubjectSem associates the node SubjectN ode with the feature value pair [index : I] and the DYN constraint index subject : I . SubjectSem → SubjectN ode [index : I] ∧ index subject : I (54)

  with feature

	Canonical Subject →	Wh-NP-Subject →	Canonical Object →	Wh-NP-Object →
	S r				S q	VP			S q
	NP↓	VP	NP↓	wh + []	S r	V⋄	NP↓	NP↓	wh + []	S r
					NP N A	VP			VP	NP N A
					ǫ					ǫ
	Canonical By Object →	Wh By Object →	Active Verb →	Passive Verb →
	VP				VP	S r			S r []
	V⋄	PP		PP	V⋄	VP
	P	NP↓		P	NP↓	V⋄
	by			by

The elementary trees displayed in this article conform to[START_REF] Abeillé | Une grammaire électronique du français[END_REF], that is, we reject the use of a VP constituent in French.

As mentioned above, we describe lexicalised TAG, thus every tree schema has to contain at least one anchor (node labelled ⋄).

C x /C x abbreviate a node with category C and a top/bottom feature structure including the feature-value pair { index : x}.

For now, let us consider that the tree fragments are combined in order to produce minimal trees by merging nodes whose categories (and features) unify. In the next section, we will see how to precisely control node identification using either node variables or node constraints.

Note that in XMG, it is not mandatory to define any tree structure inside SubjAgreement. We could define independent NP and VP nodes, and associate them with variables, say n 1 and n 2 . n 1 and n 2 would then be exported and reused directly in the classes CanonicalSubject and Wh-NP-Subject respectively.

Note that these clauses only consider canonical subjects to avoid having both a Wh-subject and a Wh-object. This is not entirely satisfactory, as we would prefer to define a single abstraction over objects (as was done for subjects) and use it wherever possible. There would then be another mechanism to capture this exception and cause the invalid combination to fail (that is, the resulting tree description not to have any model). Such a mechanism exists in XMG, and is called linguistic principle, see Section 5.

By coreference, we mean the sharing of information between distinct elementary fragments of the grammar specification.

See[START_REF] Gardent | Semantic Construction in Feature-Based Tree Adjoining Grammar[END_REF] for a detailed introduction to flat semantics.

For more details on the interpretation of flat semantics and on its association with a grammar of natural language, see[START_REF] Gardent | Integrating a unification-based semantics in a large scale Lexicalised Tree Adjoininig Grammar for French[END_REF].

In fact, the notation used by[START_REF] Vijay-Shanker | Structure sharing in lexicalized tree adjoining grammars[END_REF] is attr:X with attr an attribute variable ranging over a finite set of attributes, to indicate special node variables that scope outside their class; and attr(A) to refer to such variables from outside the entity in which they were declared. We use a different notation here to enforce consistency with the XMG notation.

Recently, XMG has been used to describe the morphology of verbs in Ikota, a Bantu language spoken in Gabon(Duchier et al. 2012).

The XMG compiler is open source software released under the terms of the CeCILL GPL-compliant licence. See http://sourcesup.renater.fr/xmg.

⊎ represents disjoint union.

These integer representations are usually called reified constraints.

In fact, rather than adding strict precedence constraints to the tree description, we directly add to the solver their equivalent set constraints on Eq, Up, Left, Right, Down, introduced above.

In other words, node colors can be seen as information on node saturation.

See(Crabbé 2005) for a complete description of SEMTAG tree fragments, including feature structures.

Recall from Section 4 that inheritance is used to share namespaces. Thus, (node or feature) variables introduced in a given class C can be directly reused in the sub-classes of C.

Note that, when these abstractions will be combined to describe for instance transitive verbs, the combination of WhObj with WhByObj will be ruled out by using a uniqueness principle such as introduced in Section 5.

It is often argued that a language of grammatical representation must be equipped with an "erasing device" like lexical rules because of phenomena such as the passive without agent. In this framework it turns out that this kind of device is not needed since we do not grant any special status to base trees.

Note that number and gender agreements are dealt with using coreferences between features labelling syntactic nodes, see(Crabbé 2005).

The principles required to handle quantification are omitted. We refer the reader to[START_REF] Gardent | Tree Adjoining Grammar, Semantic Calculi and Labelling Invariants[END_REF]) for a more extensive presentation of how semantics is implemented using XMG.

For simplicity, we only mention indices. However, to be complete, labels should also be used.

The foot projection principle only applies to foot nodes that are not argument nodes (i.e., to modifiee nodes).

In other words, this argument labelling principle defines an explicit and normalized reference to any realization of a semantic argument. Following FB-LTAG predicate-argument co-occurrence principle[START_REF] Abeillé | Ftag: current status and parsing scheme[END_REF], we know that any elementary tree includes a leaf node for each realized semantic argument of its anchor. This principle thus holds in any FB-LTAG. However, its implementation is closely related to the architecture of the metagrammar, here we benefit from the fact that verbal arguments are described in dedicated classes to reach a high degree of factorization.

For sake of brevity, we writeE 2 E 1 for [bot : [index : E 1 ] top : [index : E 2 ]].refers to the anchor / foot.

FTAG and SEMTAG are freely available under the terms of the GPL-compliant CeCILL license, the former at https: //sourcesup.renater.fr/scm/viewvc.php/trunk/METAGRAMMARS/FrenchTAG/?root=xmg, and the latter on request.

As a comparison, about one hour was needed by Candito's compiler, to produce a French FB-LTAG containing about 1,000 tree schemas.

As an alternative way to parse FB-LTAG grammars equipped with flat semantics such as those produced by XMG, one can use the Tübingen Linguistic Parsing Architecture (TuLiPA)[START_REF] Kallmeyer | TuLiPA -Parsing Extensions of TAG with Range Concatenation Grammars[END_REF]).

See https://sourcesup.renater.fr/xmg.

The French TAG and French and English IG are available on XMG's website, the German TT-MCTAG is available at http://www.sfs.uni-tuebingen.de/emmy/res.html.

Preliminary work on cross-framework grammar engineering has been realized byClément and Kinyon (2003), who used Gaiffe et al.'s compiler to produce both a TAG and a LFG from a given metagrammar.

Acknowledgments

We are grateful to the three anonymous reviewers for their valuable comments. Any remaining error is ours.

Proceedings of the 16th International

Conference on Computational Linguistics (COLING'96), pages 194-199, Copenhagen, Denmark. Candito, Marie. 1999. Représentation modulaire et paramétrable de grammaires électroniques lexicalisées : application au français et à l'italien. Ph.D. thesis, Université Paris 7. Clément, Lionel and Alexandra Kinyon. 2003. Generating parallel multilingual lfg-tag grammars from a metagrammar. In Proceedings of the 41st Annual Meeting of the Association for Computational Linguistics, pages 184-191, Sapporo, Japan, July. Cohen-Sygal, Yael and Shuly Wintner. 2007. The Non-Associativity of Polarized Tree-Based Grammars. In Proceedings of the Eighth International Conference on Intelligent Text Processing and Computational Linguistics (CICLing-2007), pages 208-217, Mexico City, Mexico. Cohen-Sygal, Yael and Shuly Wintner. 2009. Associative Grammar Combination Operators for Tree-Based Grammars. Journal of Logic, Language and Information, 18:293-316. Cohen-Sygal, Yael and Shuly Wintner. 2011. Towards modular development of typed unification grammars. Comput. Linguist., 37(1):29-74. Copestake, Ann and Dan Flickinger. 2000. An open-source grammar development environment and broad-coverage English grammar using HPSG. In Proceedings of the Second conference on Language Resources and Evaluation (LREC-2000), Athens, Greece. Copestake, Ann, Alex Lascarides, and Dan Flickinger. 2001. An algebra for semantic construction in constraint-based grammars. In Proceedings of 39th Annual Meeting of the Association for Computational Linguistics, pages 140-147, Toulouse, France, July. Association for Computational Linguistics.