ILOG's XML Serializer for the W3C Rule Interchange Format

Hassan Aït-Kaci
ILOG, Inc.


IMPORTANT DISCLAIMER

This software bundle, including Jacc and RIF serialization examples using Jacc, is made available graciously by ILOG, Inc. to the W3C RIF Working Group to ease experimenting with various schemes of XML serializations for a RIF-compliant rule language from its formal grammar.
It is provided as is: ILOG takes no responsibility for anyone's using it.


All material contained in this distribution are under
copyright © 2006 by ILOG, Inc.. All Rights Reserved.


The directory containing this HTML START_HERE.html file (i.e., this) comprises a distribution of Jacc (Just Another Compiler Compiler, a tool written in Java by Hassan Aït-Kaci, together with an example application thereof for the purpose of automating the XML serialization of formal languages expressed as context-free grammar rules (BNF).

[NB: Jacc requires Java 1.5 (a.k.a JDK 5.0) to run - it will not run under Java 1.4 or earlier.]

These are intructions documenting the contents of this distribution.

The subdirectories are:

sources:
source files (*.grm, *.java)
examples:
examples of programs to serialize
docs:
html documentation files (on Jacc and example grammars)
lib:
ilog.langage.* jar file including Jacc
classes:
repository for generated classes

This setup is meant as an illustrating example for someone interested in adapting it for similar purposes using a grammar of one's choice. It uses the initial version of the Horn Rule Language (HRL) based on the RIF Condition Language (RCL) proposed in the document [RIF] Extensible Design. The Jacc grammars given here are literal transcriptions of the BNF rules given in the above references.

The grammar HRL (which includes the rules for RCL) is defined as a combination of partial grammars. HRL and RCL were proposed by some RIF WG members from the REWERSE group. These specific languages are by no means advocated by this author as ideal for the purpose of defining a RIF, but only treated here as illustrative examples for Jacc's XML annotation capabilities. One is thus encouraged to adapt and modify the grammars and ancillary java files to suit one's needs.

NB: This is only a preliminary version of the XML serializer tool. At present, one may give annotations specifying only XML tags for some grammar rules. One may not (yet) specify attributes nor declare namespaces. The next version in the works will support all this.

Running ant in this root directory will generate a parser and XML serializer from the grammar specified in the file HRL.grm. This grammar is expressed modularly, consisting of the full language obtained using subgrammars (using Jacc's %include directive).

To run the example, you will need Apache's Ant Builder, a Java freeware tool (therefore platform-independent) implementing an XML-based version of the popular UNIX command make. If you don't have Ant, you must first download it from the Apache web site and install it. This root directory contains a Build.xml file specifying an Ant project for running the examples. Here are the most useful ant targets it defines:

ant:
prints out a usage listing of known targets
ant hrl:
generates the parser/serializer and compiles it
ant doc:
generates the HTML documentation for the HRL grammar
ant parse:
runs the HRL parser on an example file (Test.hrl).

Running the example parses the file and prompts the user asking whether or not to show the XML serialization of the parsed example. [NB: For some reason, the prompt is not displayed - simply enter a carriage return. This must be due to a bug in Ant that does not flush it output buffer despite our Java application's doing so. The correct behavior can be seen running java directly on the examples (e.g., running the UNIX shell script hrl in the examples directory - issuing the command line hrl Test.hrl).]

Please send comments and/or questions to Hassan Aït-Kaci.

Thank you very much.

Enjoy!

-hak


[last modified on Wed Oct 25 10:35:12 2006 by hak]