CoffeeFilter Test Report

Report generated on 06 Aug 2023 at 21:03 with CoffeeFilter version 3.2.1 (using CoffeeGrinder version 3.2.1) from a test suite dated 21 Jun 2022 (20 Jun 2023).

Description

Top-level catalog for tests in the iXML Community Group Test Suite.

Tests have been contributed from several sources, but the core of the test collection are the tests contributed by Steven Pemberton in December 2021.

Misc tests 3

28 Jun 2022

Description

Grammars 41-60.

Tests compiled manually in 2018 and 2019, re-packaged and extended (supplying test cases where needed) in 2022.

Note that some tests have alternate results for processors operating in non-standard modes, in particular modes in which they tolerate multiple definitions and undefined nonterminals or in which they do not tolerate non-productive nonterminals or unreachable nonterminals.

For a description of the form in which alternate results are recorded, see tests/misc-grammar/test-catalog.xml.

sample.grammar.41ter

Created 08 Feb 2022 by cmsmcq

Description

Sample grammar derived from one in Niklaus Wirth, Grundlagen und Techniken des Compilerbaus (Bonn: Addison-Wesley, 1996), pp. 36-37.

Derived from sample.grammar.41bis by rewriting the expression syntax so that nonterminals are visible in the XML only when needed to group multiple children and invisible if they have only one child.

Invisible XML Grammar
{ Sample grammar from Niklaus Wirth, Grundlagen und Techniken des
Compilerbaus (Bonn: Addison-Wesley, 1996), pp. 36-37.

Oberon-0.

Rules for ws added for convenience; Wirth assumes the lexer
eats whitespace. }

{ Revisions:
  2022-06-15 : CMSMcQ : Use the Lumley construction to trim expressions.
  2022-06-15 : CMSMcQ : revise S handling again (leading ws pattern).
                        Make selector and procedures reject epsilon
                        for clarity in the output
  2022-06-14 : CMSMcQ : revise S handling (tight tags, where possible).
                        Hide most literals, use pre-terminal symbols.
  2018-08-10 : CMSMcQ : correct syntax errors found by DCG parser
  2018-08-09 : CMSMcQ : made first transcription; needs testing, since
      the translation from Wirth's EBNF is error-prone.
}

{ We move the rule for module to the front, since it is the
start symbol. }

            module = S?, -"MODULE", S, @ident, -";", S?,
                     declarations,
                     (-"BEGIN", S?, StatementSequence)?,
                     -"END", S, @ident_close, -".", S?.
    
             ident = letter, (letter; digit)*, S?.
       ident_close = ident.
           integer = digit, (digit)*, S?.
          selector = (member; subscript)+.
	    member = -".", S?, ident.
	 subscript = -"[", S?, EXPRESSION, -"]", S?.
         {selector = (".", S?, ident; "[", S?, expression, "]", S?)*.}
           -number = integer.
           -FACTOR = ident
	           ; number
		   ; -"(", S?, EXPRESSION, -")", S?
		   ; factor
		   .
            factor = ident, selector
	           ; "~", S?, FACTOR
		   .
             -TERM = FACTOR; term.
              term = FACTOR, (TIMES; DIV; MOD; AND), FACTOR++(TIMES; DIV; MOD; AND).
             {term = factor++(TIMES; DIV; MOD; AND).}
	      
 -SIMPLEEXPRESSION =  (PLUS; MINUS)?, TERM; SimpleExpression.
  SimpleExpression =  (PLUS; MINUS)?, TERM, (PLUS; MINUS; OR), TERM++(PLUS; MINUS; OR).
 {SimpleExpression =  (PLUS; MINUS)?, term++(PLUS; MINUS; OR).}

    { N.B. Simplexpression allows 1, -1, 1 + 1,
      -1 + 1, but not 1 + -1.
      I expect that's intentional.
      I've made it also forbid white space between sign and term.
    }    
 
       -EXPRESSION = SIMPLEEXPRESSION; expression.
        expression = SIMPLEEXPRESSION, -COMPARATOR, SIMPLEEXPRESSION.
       {expression = SimpleExpression, (-COMPARATOR, SimpleExpression)?.}
       -COMPARATOR = EQL; NEQ; LSS; LEQ; GTR; GEQ.
        assignment = ident, selector?, -":=", S?, EXPRESSION.
  ActualParameters = -"(", S?, EXPRESSION**(-",", S?), -")", S?.
     ProcedureCall = ident, selector?, ActualParameters?.
       IfStatement = -"IF", S?, condition, 
                     -"THEN", S?, then-stmts,
                     (-"ELSIF", S?, condition, 
		     -"THEN", S?, then-stmts)*,
                     (-"ELSE", S?, else-stmts)?,
		     -"END", S?.
         condition = -EXPRESSION.
        then-stmts = -StatementSequence.
        else-stmts = -StatementSequence.
    WhileStatement = -"WHILE", S?, condition, 
                     -"DO", S?, do-statements,
		     -"END", S?.
     do-statements = -StatementSequence.

         statement = {}
	 	   ; assignment
		   ; ProcedureCall
		   ; IfStatement
		   ; WhileStatement
		   .
 StatementSequence = statement++(-";", S?).
 
 { Wirth's formulation is closer to the following, but that complicates whitespace
   handling. 

         statement = (assignment; ProcedureCall; IfStatement; WhileStatement)?.
 StatementSequence = statement++SEMI.
 }

         IdentList = ident++(-",", S?).
         ArrayType = -"ARRAY", S?, EXPRESSION, -"OF", S?, type.
         FieldList = (IdentList, -":", S?, type)?.
        RecordType = -"RECORD", S?, FieldList++(-";", S?), -"END", S?.
              type = ident
	           ; ArrayType
		   ; RecordType
		   .
         FPSection = (-"VAR", S)?, IdentList, -":", S?, type.
  FormalParameters = -"(", S?, FPSection**(-";", S?), -")", S?.
  ProcedureHeading = -"PROCEDURE", S, ident, FormalParameters?.
     ProcedureBody = declarations, 
                     (-"BEGIN", S?, StatementSequence)?,
		     -"END", S, @ident.
ProcedureDeclaration
                   = ProcedureHeading, -";", S?, ProcedureBody.
      declarations = constants?, types?, variables?, procedures?.
         constants = -"CONST", S, (ident, -"=", S?, EXPRESSION, -";", S?)*.
             types = -"TYPE", S, (IdentList, -"=", S?, type, -";", S?)*.
         variables = -"VAR", S, (IdentList, -":", S?, type, -";", S?)*.
        procedures = (ProcedureDeclaration, -";", S?)+.

{ S and comment added here to make the grammar usable without
  a scanner. N.B. Comments nest. }
                -S = (ws; comment)+.
               -ws = -[" "; #09; #0A; #0D].

           comment = -"(*", comment-body, -"*)".
      comment-body = comment-chars, ((comment++comment-chars), comment-chars?)?.
    -comment-chars = (cc1; cc2; cc3)+, star*, lpar* | star+, lpar* | lpar+.
              -cc1 = not-star-or-lpar.
              -cc2 = lpar+, not-star-or-lpar.
	      -cc3 = star+, lpar+, not-star-or-lpar
                   | star+, not-star-or-lrpar.
 -not-star-or-lpar = ~["*("].
-not-star-or-lrpar = ~["(*)"].
             -lpar = "(".
	     -star = "*".

            -digit = ['0'-'9'].
           -letter = ['a'-'z'; 'A'-'Z'].

             TIMES = -"*", S?.
	       DIV = -"DIV", S?.
	       MOD = -"MOD", S?.
	       AND = -"AND", S?.
	      PLUS = -"+", S?.
	     MINUS = -"-", S?.
	        OR = -"OR", S?.
               EQL = -"=", S?.
	       NEQ = -"#", S?.
	       LSS = -"<", S?.
	       LEQ = -"<=", S?.
	       GTR = -">", S?.
	       GEQ = -">=", S?.

{ Separators }

Test case: Grammar test

Repository URI: …/tests/misc/misc-041-060-catalog.xml

Expected result
<ixml>
   <comment> Sample grammar from Niklaus Wirth, Grundlagen und Techniken des
Compilerbaus (Bonn: Addison-Wesley, 1996), pp. 36-37.

Oberon-0.

Rules for ws added for convenience; Wirth assumes the lexer
eats whitespace. </comment>
   <comment> Revisions:
  2022-06-15 : CMSMcQ : Use the Lumley construction to trim expressions.
  2022-06-15 : CMSMcQ : revise S handling again (leading ws pattern).
                        Make selector and procedures reject epsilon
                        for clarity in the output
  2022-06-14 : CMSMcQ : revise S handling (tight tags, where possible).
                        Hide most literals, use pre-terminal symbols.
  2018-08-10 : CMSMcQ : correct syntax errors found by DCG parser
  2018-08-09 : CMSMcQ : made first transcription; needs testing, since
      the translation from Wirth's EBNF is error-prone.
</comment>
   <comment> We move the rule for module to the front, since it is the
start symbol. </comment>
   <rule name="module">
      <alt>
         <option>
            <nonterminal name="S"/>
         </option>
         <literal tmark="-" string="MODULE"/>
         <nonterminal name="S"/>
         <nonterminal mark="@" name="ident"/>
         <literal tmark="-" string=";"/>
         <option>
            <nonterminal name="S"/>
         </option>
         <nonterminal name="declarations"/>
         <option>
            <alts>
               <alt>
                  <literal tmark="-" string="BEGIN"/>
                  <option>
                     <nonterminal name="S"/>
                  </option>
                  <nonterminal name="StatementSequence"/>
               </alt>
            </alts>
         </option>
         <literal tmark="-" string="END"/>
         <nonterminal name="S"/>
         <nonterminal mark="@" name="ident_close"/>
         <literal tmark="-" string="."/>
         <option>
            <nonterminal name="S"/>
         </option>
      </alt>
   </rule>
   <rule name="ident">
      <alt>
         <nonterminal name="letter"/>
         <repeat0>
            <alts>
               <alt>
                  <nonterminal name="letter"/>
               </alt>
               <alt>
                  <nonterminal name="digit"/>
               </alt>
            </alts>
         </repeat0>
         <option>
            <nonterminal name="S"/>
         </option>
      </alt>
   </rule>
   <rule name="ident_close">
      <alt>
         <nonterminal name="ident"/>
      </alt>
   </rule>
   <rule name="integer">
      <alt>
         <nonterminal name="digit"/>
         <repeat0>
            <alts>
               <alt>
                  <nonterminal name="digit"/>
               </alt>
            </alts>
         </repeat0>
         <option>
            <nonterminal name="S"/>
         </option>
      </alt>
   </rule>
   <rule name="selector">
      <alt>
         <repeat1>
            <alts>
               <alt>
                  <nonterminal name="member"/>
               </alt>
               <alt>
                  <nonterminal name="subscript"/>
               </alt>
            </alts>
         </repeat1>
      </alt>
   </rule>
   <rule name="member">
      <alt>
         <literal tmark="-" string="."/>
         <option>
            <nonterminal name="S"/>
         </option>
         <nonterminal name="ident"/>
      </alt>
   </rule>
   <rule name="subscript">
      <alt>
         <literal tmark="-" string="["/>
         <option>
            <nonterminal name="S"/>
         </option>
         <nonterminal name="EXPRESSION"/>
         <literal tmark="-" string="]"/>
         <option>
            <nonterminal name="S"/>
         </option>
      </alt>
   </rule>
   <comment>selector = (".", S?, ident; "[", S?, expression, "]", S?)*.</comment>
   <rule mark="-" name="number">
      <alt>
         <nonterminal name="integer"/>
      </alt>
   </rule>
   <rule mark="-" name="FACTOR">
      <alt>
         <nonterminal name="ident"/>
      </alt>
      <alt>
         <nonterminal name="number"/>
      </alt>
      <alt>
         <literal tmark="-" string="("/>
         <option>
            <nonterminal name="S"/>
         </option>
         <nonterminal name="EXPRESSION"/>
         <literal tmark="-" string=")"/>
         <option>
            <nonterminal name="S"/>
         </option>
      </alt>
      <alt>
         <nonterminal name="factor"/>
      </alt>
   </rule>
   <rule name="factor">
      <alt>
         <nonterminal name="ident"/>
         <nonterminal name="selector"/>
      </alt>
      <alt>
         <literal string="~"/>
         <option>
            <nonterminal name="S"/>
         </option>
         <nonterminal name="FACTOR"/>
      </alt>
   </rule>
   <rule mark="-" name="TERM">
      <alt>
         <nonterminal name="FACTOR"/>
      </alt>
      <alt>
         <nonterminal name="term"/>
      </alt>
   </rule>
   <rule name="term">
      <alt>
         <nonterminal name="FACTOR"/>
         <alts>
            <alt>
               <nonterminal name="TIMES"/>
            </alt>
            <alt>
               <nonterminal name="DIV"/>
            </alt>
            <alt>
               <nonterminal name="MOD"/>
            </alt>
            <alt>
               <nonterminal name="AND"/>
            </alt>
         </alts>
         <repeat1>
            <nonterminal name="FACTOR"/>
            <sep>
               <alts>
                  <alt>
                     <nonterminal name="TIMES"/>
                  </alt>
                  <alt>
                     <nonterminal name="DIV"/>
                  </alt>
                  <alt>
                     <nonterminal name="MOD"/>
                  </alt>
                  <alt>
                     <nonterminal name="AND"/>
                  </alt>
               </alts>
            </sep>
         </repeat1>
      </alt>
   </rule>
   <comment>term = factor++(TIMES; DIV; MOD; AND).</comment>
   <rule mark="-" name="SIMPLEEXPRESSION">
      <alt>
         <option>
            <alts>
               <alt>
                  <nonterminal name="PLUS"/>
               </alt>
               <alt>
                  <nonterminal name="MINUS"/>
               </alt>
            </alts>
         </option>
         <nonterminal name="TERM"/>
      </alt>
      <alt>
         <nonterminal name="SimpleExpression"/>
      </alt>
   </rule>
   <rule name="SimpleExpression">
      <alt>
         <option>
            <alts>
               <alt>
                  <nonterminal name="PLUS"/>
               </alt>
               <alt>
                  <nonterminal name="MINUS"/>
               </alt>
            </alts>
         </option>
         <nonterminal name="TERM"/>
         <alts>
            <alt>
               <nonterminal name="PLUS"/>
            </alt>
            <alt>
               <nonterminal name="MINUS"/>
            </alt>
            <alt>
               <nonterminal name="OR"/>
            </alt>
         </alts>
         <repeat1>
            <nonterminal name="TERM"/>
            <sep>
               <alts>
                  <alt>
                     <nonterminal name="PLUS"/>
                  </alt>
                  <alt>
                     <nonterminal name="MINUS"/>
                  </alt>
                  <alt>
                     <nonterminal name="OR"/>
                  </alt>
               </alts>
            </sep>
         </repeat1>
      </alt>
   </rule>
   <comment>SimpleExpression =  (PLUS; MINUS)?, term++(PLUS; MINUS; OR).</comment>
   <comment> N.B. Simplexpression allows 1, -1, 1 + 1,
      -1 + 1, but not 1 + -1.
      I expect that's intentional.
      I've made it also forbid white space between sign and term.
    </comment>
   <rule mark="-" name="EXPRESSION">
      <alt>
         <nonterminal name="SIMPLEEXPRESSION"/>
      </alt>
      <alt>
         <nonterminal name="expression"/>
      </alt>
   </rule>
   <rule name="expression">
      <alt>
         <nonterminal name="SIMPLEEXPRESSION"/>
         <nonterminal mark="-" name="COMPARATOR"/>
         <nonterminal name="SIMPLEEXPRESSION"/>
      </alt>
   </rule>
   <comment>expression = SimpleExpression, (-COMPARATOR, SimpleExpression)?.</comment>
   <rule mark="-" name="COMPARATOR">
      <alt>
         <nonterminal name="EQL"/>
      </alt>
      <alt>
         <nonterminal name="NEQ"/>
      </alt>
      <alt>
         <nonterminal name="LSS"/>
      </alt>
      <alt>
         <nonterminal name="LEQ"/>
      </alt>
      <alt>
         <nonterminal name="GTR"/>
      </alt>
      <alt>
         <nonterminal name="GEQ"/>
      </alt>
   </rule>
   <rule name="assignment">
      <alt>
         <nonterminal name="ident"/>
         <option>
            <nonterminal name="selector"/>
         </option>
         <literal tmark="-" string=":="/>
         <option>
            <nonterminal name="S"/>
         </option>
         <nonterminal name="EXPRESSION"/>
      </alt>
   </rule>
   <rule name="ActualParameters">
      <alt>
         <literal tmark="-" string="("/>
         <option>
            <nonterminal name="S"/>
         </option>
         <repeat0>
            <nonterminal name="EXPRESSION"/>
            <sep>
               <alts>
                  <alt>
                     <literal tmark="-" string=","/>
                     <option>
                        <nonterminal name="S"/>
                     </option>
                  </alt>
               </alts>
            </sep>
         </repeat0>
         <literal tmark="-" string=")"/>
         <option>
            <nonterminal name="S"/>
         </option>
      </alt>
   </rule>
   <rule name="ProcedureCall">
      <alt>
         <nonterminal name="ident"/>
         <option>
            <nonterminal name="selector"/>
         </option>
         <option>
            <nonterminal name="ActualParameters"/>
         </option>
      </alt>
   </rule>
   <rule name="IfStatement">
      <alt>
         <literal tmark="-" string="IF"/>
         <option>
            <nonterminal name="S"/>
         </option>
         <nonterminal name="condition"/>
         <literal tmark="-" string="THEN"/>
         <option>
            <nonterminal name="S"/>
         </option>
         <nonterminal name="then-stmts"/>
         <repeat0>
            <alts>
               <alt>
                  <literal tmark="-" string="ELSIF"/>
                  <option>
                     <nonterminal name="S"/>
                  </option>
                  <nonterminal name="condition"/>
                  <literal tmark="-" string="THEN"/>
                  <option>
                     <nonterminal name="S"/>
                  </option>
                  <nonterminal name="then-stmts"/>
               </alt>
            </alts>
         </repeat0>
         <option>
            <alts>
               <alt>
                  <literal tmark="-" string="ELSE"/>
                  <option>
                     <nonterminal name="S"/>
                  </option>
                  <nonterminal name="else-stmts"/>
               </alt>
            </alts>
         </option>
         <literal tmark="-" string="END"/>
         <option>
            <nonterminal name="S"/>
         </option>
      </alt>
   </rule>
   <rule name="condition">
      <alt>
         <nonterminal mark="-" name="EXPRESSION"/>
      </alt>
   </rule>
   <rule name="then-stmts">
      <alt>
         <nonterminal mark="-" name="StatementSequence"/>
      </alt>
   </rule>
   <rule name="else-stmts">
      <alt>
         <nonterminal mark="-" name="StatementSequence"/>
      </alt>
   </rule>
   <rule name="WhileStatement">
      <alt>
         <literal tmark="-" string="WHILE"/>
         <option>
            <nonterminal name="S"/>
         </option>
         <nonterminal name="condition"/>
         <literal tmark="-" string="DO"/>
         <option>
            <nonterminal name="S"/>
         </option>
         <nonterminal name="do-statements"/>
         <literal tmark="-" string="END"/>
         <option>
            <nonterminal name="S"/>
         </option>
      </alt>
   </rule>
   <rule name="do-statements">
      <alt>
         <nonterminal mark="-" name="StatementSequence"/>
      </alt>
   </rule>
   <rule name="statement">
      <comment/>
      <alt/>
      <alt>
         <nonterminal name="assignment"/>
      </alt>
      <alt>
         <nonterminal name="ProcedureCall"/>
      </alt>
      <alt>
         <nonterminal name="IfStatement"/>
      </alt>
      <alt>
         <nonterminal name="WhileStatement"/>
      </alt>
   </rule>
   <rule name="StatementSequence">
      <alt>
         <repeat1>
            <nonterminal name="statement"/>
            <sep>
               <alts>
                  <alt>
                     <literal tmark="-" string=";"/>
                     <option>
                        <nonterminal name="S"/>
                     </option>
                  </alt>
               </alts>
            </sep>
         </repeat1>
      </alt>
   </rule>
   <comment> Wirth's formulation is closer to the following, but that complicates whitespace
   handling. 

         statement = (assignment; ProcedureCall; IfStatement; WhileStatement)?.
 StatementSequence = statement++SEMI.
 </comment>
   <rule name="IdentList">
      <alt>
         <repeat1>
            <nonterminal name="ident"/>
            <sep>
               <alts>
                  <alt>
                     <literal tmark="-" string=","/>
                     <option>
                        <nonterminal name="S"/>
                     </option>
                  </alt>
               </alts>
            </sep>
         </repeat1>
      </alt>
   </rule>
   <rule name="ArrayType">
      <alt>
         <literal tmark="-" string="ARRAY"/>
         <option>
            <nonterminal name="S"/>
         </option>
         <nonterminal name="EXPRESSION"/>
         <literal tmark="-" string="OF"/>
         <option>
            <nonterminal name="S"/>
         </option>
         <nonterminal name="type"/>
      </alt>
   </rule>
   <rule name="FieldList">
      <alt>
         <option>
            <alts>
               <alt>
                  <nonterminal name="IdentList"/>
                  <literal tmark="-" string=":"/>
                  <option>
                     <nonterminal name="S"/>
                  </option>
                  <nonterminal name="type"/>
               </alt>
            </alts>
         </option>
      </alt>
   </rule>
   <rule name="RecordType">
      <alt>
         <literal tmark="-" string="RECORD"/>
         <option>
            <nonterminal name="S"/>
         </option>
         <repeat1>
            <nonterminal name="FieldList"/>
            <sep>
               <alts>
                  <alt>
                     <literal tmark="-" string=";"/>
                     <option>
                        <nonterminal name="S"/>
                     </option>
                  </alt>
               </alts>
            </sep>
         </repeat1>
         <literal tmark="-" string="END"/>
         <option>
            <nonterminal name="S"/>
         </option>
      </alt>
   </rule>
   <rule name="type">
      <alt>
         <nonterminal name="ident"/>
      </alt>
      <alt>
         <nonterminal name="ArrayType"/>
      </alt>
      <alt>
         <nonterminal name="RecordType"/>
      </alt>
   </rule>
   <rule name="FPSection">
      <alt>
         <option>
            <alts>
               <alt>
                  <literal tmark="-" string="VAR"/>
                  <nonterminal name="S"/>
               </alt>
            </alts>
         </option>
         <nonterminal name="IdentList"/>
         <literal tmark="-" string=":"/>
         <option>
            <nonterminal name="S"/>
         </option>
         <nonterminal name="type"/>
      </alt>
   </rule>
   <rule name="FormalParameters">
      <alt>
         <literal tmark="-" string="("/>
         <option>
            <nonterminal name="S"/>
         </option>
         <repeat0>
            <nonterminal name="FPSection"/>
            <sep>
               <alts>
                  <alt>
                     <literal tmark="-" string=";"/>
                     <option>
                        <nonterminal name="S"/>
                     </option>
                  </alt>
               </alts>
            </sep>
         </repeat0>
         <literal tmark="-" string=")"/>
         <option>
            <nonterminal name="S"/>
         </option>
      </alt>
   </rule>
   <rule name="ProcedureHeading">
      <alt>
         <literal tmark="-" string="PROCEDURE"/>
         <nonterminal name="S"/>
         <nonterminal name="ident"/>
         <option>
            <nonterminal name="FormalParameters"/>
         </option>
      </alt>
   </rule>
   <rule name="ProcedureBody">
      <alt>
         <nonterminal name="declarations"/>
         <option>
            <alts>
               <alt>
                  <literal tmark="-" string="BEGIN"/>
                  <option>
                     <nonterminal name="S"/>
                  </option>
                  <nonterminal name="StatementSequence"/>
               </alt>
            </alts>
         </option>
         <literal tmark="-" string="END"/>
         <nonterminal name="S"/>
         <nonterminal mark="@" name="ident"/>
      </alt>
   </rule>
   <rule name="ProcedureDeclaration">
      <alt>
         <nonterminal name="ProcedureHeading"/>
         <literal tmark="-" string=";"/>
         <option>
            <nonterminal name="S"/>
         </option>
         <nonterminal name="ProcedureBody"/>
      </alt>
   </rule>
   <rule name="declarations">
      <alt>
         <option>
            <nonterminal name="constants"/>
         </option>
         <option>
            <nonterminal name="types"/>
         </option>
         <option>
            <nonterminal name="variables"/>
         </option>
         <option>
            <nonterminal name="procedures"/>
         </option>
      </alt>
   </rule>
   <rule name="constants">
      <alt>
         <literal tmark="-" string="CONST"/>
         <nonterminal name="S"/>
         <repeat0>
            <alts>
               <alt>
                  <nonterminal name="ident"/>
                  <literal tmark="-" string="="/>
                  <option>
                     <nonterminal name="S"/>
                  </option>
                  <nonterminal name="EXPRESSION"/>
                  <literal tmark="-" string=";"/>
                  <option>
                     <nonterminal name="S"/>
                  </option>
               </alt>
            </alts>
         </repeat0>
      </alt>
   </rule>
   <rule name="types">
      <alt>
         <literal tmark="-" string="TYPE"/>
         <nonterminal name="S"/>
         <repeat0>
            <alts>
               <alt>
                  <nonterminal name="IdentList"/>
                  <literal tmark="-" string="="/>
                  <option>
                     <nonterminal name="S"/>
                  </option>
                  <nonterminal name="type"/>
                  <literal tmark="-" string=";"/>
                  <option>
                     <nonterminal name="S"/>
                  </option>
               </alt>
            </alts>
         </repeat0>
      </alt>
   </rule>
   <rule name="variables">
      <alt>
         <literal tmark="-" string="VAR"/>
         <nonterminal name="S"/>
         <repeat0>
            <alts>
               <alt>
                  <nonterminal name="IdentList"/>
                  <literal tmark="-" string=":"/>
                  <option>
                     <nonterminal name="S"/>
                  </option>
                  <nonterminal name="type"/>
                  <literal tmark="-" string=";"/>
                  <option>
                     <nonterminal name="S"/>
                  </option>
               </alt>
            </alts>
         </repeat0>
      </alt>
   </rule>
   <rule name="procedures">
      <alt>
         <repeat1>
            <alts>
               <alt>
                  <nonterminal name="ProcedureDeclaration"/>
                  <literal tmark="-" string=";"/>
                  <option>
                     <nonterminal name="S"/>
                  </option>
               </alt>
            </alts>
         </repeat1>
      </alt>
   </rule>
   <comment> S and comment added here to make the grammar usable without
  a scanner. N.B. Comments nest. </comment>
   <rule mark="-" name="S">
      <alt>
         <repeat1>
            <alts>
               <alt>
                  <nonterminal name="ws"/>
               </alt>
               <alt>
                  <nonterminal name="comment"/>
               </alt>
            </alts>
         </repeat1>
      </alt>
   </rule>
   <rule mark="-" name="ws">
      <alt>
         <inclusion tmark="-">
            <member string=" "/>
            <member hex="09"/>
            <member hex="0A"/>
            <member hex="0D"/>
         </inclusion>
      </alt>
   </rule>
   <rule name="comment">
      <alt>
         <literal tmark="-" string="(*"/>
         <nonterminal name="comment-body"/>
         <literal tmark="-" string="*)"/>
      </alt>
   </rule>
   <rule name="comment-body">
      <alt>
         <nonterminal name="comment-chars"/>
         <option>
            <alts>
               <alt>
                  <alts>
                     <alt>
                        <repeat1>
                           <nonterminal name="comment"/>
                           <sep>
                              <nonterminal name="comment-chars"/>
                           </sep>
                        </repeat1>
                     </alt>
                  </alts>
                  <option>
                     <nonterminal name="comment-chars"/>
                  </option>
               </alt>
            </alts>
         </option>
      </alt>
   </rule>
   <rule mark="-" name="comment-chars">
      <alt>
         <repeat1>
            <alts>
               <alt>
                  <nonterminal name="cc1"/>
               </alt>
               <alt>
                  <nonterminal name="cc2"/>
               </alt>
               <alt>
                  <nonterminal name="cc3"/>
               </alt>
            </alts>
         </repeat1>
         <repeat0>
            <nonterminal name="star"/>
         </repeat0>
         <repeat0>
            <nonterminal name="lpar"/>
         </repeat0>
      </alt>
      <alt>
         <repeat1>
            <nonterminal name="star"/>
         </repeat1>
         <repeat0>
            <nonterminal name="lpar"/>
         </repeat0>
      </alt>
      <alt>
         <repeat1>
            <nonterminal name="lpar"/>
         </repeat1>
      </alt>
   </rule>
   <rule mark="-" name="cc1">
      <alt>
         <nonterminal name="not-star-or-lpar"/>
      </alt>
   </rule>
   <rule mark="-" name="cc2">
      <alt>
         <repeat1>
            <nonterminal name="lpar"/>
         </repeat1>
         <nonterminal name="not-star-or-lpar"/>
      </alt>
   </rule>
   <rule mark="-" name="cc3">
      <alt>
         <repeat1>
            <nonterminal name="star"/>
         </repeat1>
         <repeat1>
            <nonterminal name="lpar"/>
         </repeat1>
         <nonterminal name="not-star-or-lpar"/>
      </alt>
      <alt>
         <repeat1>
            <nonterminal name="star"/>
         </repeat1>
         <nonterminal name="not-star-or-lrpar"/>
      </alt>
   </rule>
   <rule mark="-" name="not-star-or-lpar">
      <alt>
         <exclusion>
            <member string="*("/>
         </exclusion>
      </alt>
   </rule>
   <rule mark="-" name="not-star-or-lrpar">
      <alt>
         <exclusion>
            <member string="(*)"/>
         </exclusion>
      </alt>
   </rule>
   <rule mark="-" name="lpar">
      <alt>
         <literal string="("/>
      </alt>
   </rule>
   <rule mark="-" name="star">
      <alt>
         <literal string="*"/>
      </alt>
   </rule>
   <rule mark="-" name="digit">
      <alt>
         <inclusion>
            <member from="0" to="9"/>
         </inclusion>
      </alt>
   </rule>
   <rule mark="-" name="letter">
      <alt>
         <inclusion>
            <member from="a" to="z"/>
            <member from="A" to="Z"/>
         </inclusion>
      </alt>
   </rule>
   <rule name="TIMES">
      <alt>
         <literal tmark="-" string="*"/>
         <option>
            <nonterminal name="S"/>
         </option>
      </alt>
   </rule>
   <rule name="DIV">
      <alt>
         <literal tmark="-" string="DIV"/>
         <option>
            <nonterminal name="S"/>
         </option>
      </alt>
   </rule>
   <rule name="MOD">
      <alt>
         <literal tmark="-" string="MOD"/>
         <option>
            <nonterminal name="S"/>
         </option>
      </alt>
   </rule>
   <rule name="AND">
      <alt>
         <literal tmark="-" string="AND"/>
         <option>
            <nonterminal name="S"/>
         </option>
      </alt>
   </rule>
   <rule name="PLUS">
      <alt>
         <literal tmark="-" string="+"/>
         <option>
            <nonterminal name="S"/>
         </option>
      </alt>
   </rule>
   <rule name="MINUS">
      <alt>
         <literal tmark="-" string="-"/>
         <option>
            <nonterminal name="S"/>
         </option>
      </alt>
   </rule>
   <rule name="OR">
      <alt>
         <literal tmark="-" string="OR"/>
         <option>
            <nonterminal name="S"/>
         </option>
      </alt>
   </rule>
   <rule name="EQL">
      <alt>
         <literal tmark="-" string="="/>
         <option>
            <nonterminal name="S"/>
         </option>
      </alt>
   </rule>
   <rule name="NEQ">
      <alt>
         <literal tmark="-" string="#"/>
         <option>
            <nonterminal name="S"/>
         </option>
      </alt>
   </rule>
   <rule name="LSS">
      <alt>
         <literal tmark="-" string="&lt;"/>
         <option>
            <nonterminal name="S"/>
         </option>
      </alt>
   </rule>
   <rule name="LEQ">
      <alt>
         <literal tmark="-" string="&lt;="/>
         <option>
            <nonterminal name="S"/>
         </option>
      </alt>
   </rule>
   <rule name="GTR">
      <alt>
         <literal tmark="-" string="&gt;"/>
         <option>
            <nonterminal name="S"/>
         </option>
      </alt>
   </rule>
   <rule name="GEQ">
      <alt>
         <literal tmark="-" string="&gt;="/>
         <option>
            <nonterminal name="S"/>
         </option>
      </alt>
   </rule>
   <comment> Separators </comment>
</ixml>

Test report

PASS