This is EDG - Example-based Development of Grammars. It is a system implemented in Common Lisp for building natural language grammars and lexicons incrementally and interactively. It uses the general principles of HPSG (Head-Driven Phrase Structure Grammar), as described in the 1994 book by the same name by Carl Pollard and Ivan Sag.

This was developed by Eugene Koontz (


This is version 0.1; there is much more coming and much to do. For example : -Networking - the system can listen on a TCP port and parse sentences and return the parse. The socket code needs to be ported from Allegro Common Lisp-specific code so that it works portably.

Getting Started with EDG

EDG has been tested and is known to work on two implementations of Common Lisp :

Start your lisp environment, and try the following steps :

  1. (load "load-edg")
  2. (load-all) ;(this step may take a couple of minutes.)
  3. (in-package english)
  4. (parse "hiro likes shiva")
  5. (show (first (first *))

The last step should produce the system's analysis of the sentence "hiro likes shiva".

XML Usage

EDG supports output in XML. This is useful for web-based applications that use an XSLT transformation to turn the XML into HTML. For example, do :

(with-open-file (xmlout "hiro.xml" :direction :output)
	       (show (first (first (parse "hiro sleeps"))) :as 'xml :stream xmlout))

After doing this, you can process the file "hiro.xml" with an XSLT processor and a stylesheet. For example, you can use the Sablotron processor (GPL licenced) and this stylesheet : type.xsl.

After installing Sablotron, you should be able to the following : sabcmd doc/type.xsl hiro.xml > hiro.html

The file "hiro.html" may now be viewed with a web browser.

Caution : old web browsers, like Netscape 4, may crash on this file due to the large amount of nesting tables. Netscape 6, Mozilla, Internet Explorer 5 and above, and Konqueror seem to work fine.

A paper on this functionality was submitted to the NLPXML-2002 Conference, which I will post here when I get permission from the organizers.


This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 1, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
GNU General Public License for more details.

Eugene Koontz
Last modified: Thu May 16 14:35:37 PDT 2002