`RCL.grm`

    //  FILE. . . . . /home/hak/ilt/src/ilog/rcl/RCL.grm
    //  EDIT BY . . . Hassan Ait-Kaci
    //  ON MACHINE. . Latitude407.Ilog.Biz
    //  STARTED ON. . Wed Apr 26 10:17:23 2006

    //  Last modified on Thu Sep 21 08:09:21 2006 by hak

This is a Jacc grammar for RIF Condition Language (RCL) defined as a combination of partial grammars. It has evolved out of the first-cut grammar for a minimal "human-readable" syntax, which is described in the proposal submitted to the W3C Working Group on the Rule Interchange Format (RIF) by Harold Boley et al., on April 23, 2006. It is meant to be able to express the abstract syntax form taken by conditions of the rules that appear to be common to a reasonably large variety of families of rule languages. The proposal in question is available from the public RIF WG mail archive: [RIF] Extensible Design. This Jacc grammar specification is a literal transcription of the BNF rules given in the above reference. This version of the RCL grammar is annotated for simple XML serialization. We give below the Jacc grammar rules for RCL. Note that the grammar their combination defines is LALR(1). This HTML file is the root of a hyperlinked documentation allowing one to explore the grammar via navigation through its elements - rules, terminal and non-terminal symbols. The comments accompanying some rules come from the original documents. It also contains the pure Yacc rules. The documentation is generated by Jacc from the Jacc grammar specified in file `RCL.grm`. Along with this Jacc grammar file, there are other supporting source files. Essentially, the rule format is that of Yacc. As in Yacc, Jacc rules may be annotated with semantic actions, in the form of code involving the rule's RHS constituents (denoted by `$1`, `$2`, ..., `$n` - the so-called pseudo-variables where the index `n` in `$n` refers to the order of RHS constituents. Such actions appear between curly braces ('`{`' and '`}`') wherever a symbol may appear in a rule's RHS. Jacc also allows an additional form of annotation in the RHS of a rule to indicate the XML serialization pattern of the abstract syntactic tree (AST) node corresponding to a derivation with this rule. This XML serialization meta-annotation comes between square brackets ('`[`' and '`]`') and is of the form:
      [ XmlTag n_1 ... n_k ]
where `XmlTag` is an identifier to use as XML tag for this node in the XML serialization of the AST, and the `n_k`'s are a sequence of numbers denoting positions of symbols in the RHS of the rule (as for pseudo-variables but without `'$'`). The number sequence indicates the order in which subnodes are to be serialized. For example, the annotated rule:
      QUANTIF
         : 'Exists' Var_plus '(' CONDIT ')'
           [ Exists 2 4 ]
         ;
means that an AST node for this rule will be serialized thus:
       <Exists>
         (Xml serialization of Var_plus)
         (Xml serialization of CONDIT)
       </Exists>
Rules without XML serialization annotation follow a default behavior: the serialization is the concatenation of those of its RHS's constituents, eliminating punctuation tokens (i.e., empty nodes and literal tokens - namely, tokens that do not carry a value). For example, see the two test files `Test.rcl` and `Test2.rcl`. Running the command `rcl` on them produces the output shown in `Test.run`.

    ////////////////////////////////////////////////////////////////////////

    %package ilog.rif;

    %include "ParserCode.grm"  // Code for setting params and showing xml serialization

    %token Var Rel Fun Value Object

    %start RCL

    %%

    RCL
      : CONDIT { showXml(); }

This rule is just a root for the non-terminal symbol denoting having recognized an RCL construct. For now, it recognizes a RIF condition (a $CONDIT$) as defined in [RIF] Extensible Design. Its semantic action amounts to print out the XML serialization of the parsed $CONDIT$ construct on the standard output.

      ;

    %include RCL_basis.grm
    %include RCL_valobj.grm // %include RCL_constant.grm
    %include RCL_forall.grm
    %include RCL_neg.grm
    %include RCL_naf.grm
    %include RCL_nafneg.grm

    %%

This file was generated on Thu Sep 21 08:10:12 PDT 2006 from file `RCL.grm`
by the `ilog.language.tools.Hilite` Java tool written by Hassan Aït-Kaci