XMG Project Page at Sourcesup
Browse Subversion repository for the XMG Project at Sourcesup

XMG - eXtensible MetaGrammar

Benoit Crabbé Denys Duchier Joseph Le Roux Yannick Parmentier

Calligramme / TALARIS projects - LORIA

A new version of the XMG compiler is being developed in Prolog/Python. XMG2 implements some new features for modular grammar development. Its source code is freely available on launchpad (documentation).

Latest news


eXtensible MetaGrammar (XMG) is a tool for designing large scaled grammars for natural language. It implements an alternative language of grammatical representation to the classical languages used for this purpose such as PATR II. Provided a compact representation of grammatical information, XMG combines elementary fragments of information to output a fully redundant strongly lexicalised grammar.


Some underlying ideas

XMG is a framework for describing grammatical information without redundancy. More specifically it has been designed to ease the development of strongly lexicalised syntactic formalisms by means of elementary descriptive fragments. The system consists of two main components: a control device aimed at controlling how fragments are to be combined together in order to describe meaningful lexical descriptions and a composition system aimed at resolving how elementary descriptions are to be combined.

Technically, the control device is understood as a logic program of the DCG paradigm, where the terminal symbols are fragments describing some structures. The composition system is a model builder that allows to parametrise the structures output by the compiler (currently trees for Tree Adjoining Grammars and D-Trees for Interaction Grammars). The model-theoretic approach to describing the lexicon also allows linguists to further use an extensible library of constraints, called principles, ensuring additional well-formedness conditions on the output structures.



XMG Currently implements :

Current version: 1.1.6



The XMG documentation is available as a wiki here, you can download a printable pdf version here.

Moreover we suggest that you read the following papers:

Further information is also available on the XMG Project page at sourcesup (last news, forums, archives, etc).

In particular, one may have a look at the documentation of Benoît Crabbé's TAG for French (documentation in French).
The metagrammar from which this grammar is compiled is available in the XMG Subversion repository. That is, once you downloaded the XMG sources via:
svn checkout http://subversion.renater.fr/xmg local_repository The metagrammar is available under local_repository/trunk/METAGRAMMAR/FrenchTAG.



To use XMG, you require the Oz/Mozart system, which you can download at the following adress:
This system works under the following platforms:
Windows (95/98/ME/NT/2000/XP)
Notice that under MacOS, you need to install the MacOS SDK in order to have a C++ compiler. Similarly, under Windows, you need to have access to a GNU c++ compiler (for instance by using cygwin).

Make sure you have Tcl/Tk installed and activated. In particular, under Gentoo, add dev-lang/mozart tk tcl in the file /etc/portage/package.use.

You also need to install the "Select" library available at:
Once Oz-Mozart is installed, just go to the directory containing the Select package and type:
ozmake --install --package=duchier-select__1.3.0__source__1.8.pkg NB: the ozmake command is now part of the Oz-Mozart system. Once you have installed Oz-Mozart, you do not need to install any additional package before invoking ozmake.

Please note there is a bug in the version 1.3.2 of the Oz / Mozart system under windows making the installation of the select package hang. This bug does not appear with version 1.3.1 for windows. Furthermore the other (linux, mac, etc.) packages are not affected with this bug.



The easiest way to get XMG is either:

1) to install it as an ozmake package, which is available here (current version: xmg-1.1.6.pkg).

See the installation instructions.

2) to compile it from the sources.

a) You can download the last version of the sources from a Subversion repository with anonymous access (last updates, recommended). The commands are the following:
svn checkout http://subversion.renater.fr/xmg local_repository Once you have imported the sources, invoke: cd local_repository/trunk/MGCOMPILER/
ozmake --upgrade

b) Here is a stable release (current version: xmg-1.1.6.tar.gz)

Furthermore, here are some additional useful documents: Once you have downloaded the tarballs to a local file e.g. xmg-xxx.tar.gz on your computer, then invoke: tar xzvf xmg-xxx.tar.gz
cd xmg-xxx
ozmake --upgrade
This will install the two executables in your ~/.oz/1.3.2/bin directory (don't forget to update your $PATH).

NB: if you installed the packages built with Oz-Mozart 1.3.1, you may have to create a symbolic link between ~/.oz/1.3.1/bin and ~/.oz/1.3.2/bin.

For Mac OS X users, here is a nice documentation for installing XMG and its dependencies (courtesy of Patrick Watrin).



This contribution is distributed either as an ozmake package or as sources. To install xmg's ozmake package, download it to a local file e.g. xmg-xxx.pkg on your computer, then invoke: ozmake --install --package=xmg-xxx.pkg If this package was already installed on your computer and you want to upgrade to a newer version, invoke: ozmake --upgrade --package=xmg-xxx.pkg or else ozmake will complain. By default ozmake installs all binary files in the user's ~/.oz/1.3.2/bin directory tree.

NB: the ozmake command is now part of the Oz-Mozart system. Once you have installed Oz-Mozart, you do not need to install any additional package before invoking ozmake.



MetaTAG metagrammar_file
Compile a TAG metagrammar to produce a TAG 

MetaIG metagrammar_file
Compile an IG metagrammar to produce an IG

MetaTAG's Options

Prints the TAG trees through a Qtk GUI (default)
Prints the TAG trees in an XML format, in stdout!
-o file.xml
Specify the name of the output file (here "file.xml")
Prints the TAG trees in a binary format (persistent data, see Pickle) for using with the XMG tools
-c file.rec
Specify the name of the binary output file (here "file.rec")
Prints semantic information (macros) in a file specified by the "-s" option.
-s file
To specify the name of the file containing semantic macros (.mac extension added automatically).
Prints the links between valuations and semantic classes in a file specified by the "-l" option.
-l file
To specify the name of the file containing links valuation - semantic classes (.lin extension added automatically). -s Int
To split the grammar in "Int" several files (m stands for many).

MetaIG's Options

Prints the IG tree descriptions in an XML format in stdout! (default)
-o file.xml
Specify the name of the output file (here "file.xml")

(A GUI to visualize the d-trees of the Interaction Grammar is available within the LEOPAR system, see Related Softwares).




XMG tools

We have developed additional tools to ease metagrammar conception or integration with other applications. Among these:

All these programs are included in the Subversion repository (so they have been imported when you downloaded the xmg sources). The installation process is identical to XMG's (except for the classbrowser, hierarchy_printer and XMGExtractor for which there is no need to type "ozmake --upgrade"), i.e.: cd local_repository/trunk/XMG-TOOLS/MODULE-NAME
ozmake --upgrade


Related softwares

The automatically produced grammars can be used for parsing. We are currently working on integration of XMG with TAG and IG parsers.

TAG parsers

You may also be interested in Semantic Construction during parsing with TAG, see SemConst and TuLiPA.

IG parser

Generation with TAG

GenI is a surface realiser for TAG, which works with TAG produced using XMG (provided they are equipped with semantics).


Benoit Crabbé Denys Duchier Joseph Le Roux Yannick Parmentier - (Last Revised: August 04, 2014)