iXML Community Group Test Suite

23 Oct 2023 (22 Nov 2023)

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 2

28 Jun 2022

Grammars 21-40.

Test grammars compiled manually in 2018 and 2019, re-packaged in 2022.

Added test cases where needed and moved to ixml test collection, June 2022.

sample.grammar.39

Created 08 Feb 2022 by cmsmcq

Updated 13 Jun 2022 by cmsmcq

mark delimiters and space as hidden, correct space-handling blunders

Sample grammar from Niklaus Wirth, Grundlagen und Techniken des Compilerbaus (Bonn: Addison-Wesley, 1996, p. 8.

Grammar for EBNF as Wirth uses it. Rules for ws added for convenience; Wirth assumes the lexer eats whitespace.

Invisible XML Grammar


      syntax:  S?, production**S, S?.
      production: identifier, S?, "=", S?, expression, S?, ".".
      expression: term++(S?, -"|", S?).
      term: factor++S.
      factor: identifier; string;
      "(", S?, expression, S?, ")";
      "[", S?, expression, S?, "]";
      "{", S?, expression, S?, "}".

      identifier: letter, (letter; digit)*.
      string: '"', character*, '"'.
      -letter: ["A"-"Z"; "a"-"z"].
      -digit: ["0"-"9"].

      { Wirth does not define character. }
      -character: ~['"'].

      { Wirth does not define empty-set symbol. }
      nil: .

      -S: -[" "; #09; #0A; #0D]+.

    

Test case: g39.c02

Repository URI: …/tests/misc/misc-021-040-catalog.xml

Input string (112 characters)


      A = T | A "+" T.
      T = F | T "*" F.
      F = V | "(" A ")".
      V = "a" | "b" | "c" | "d".	
      

Expected result

<syntax>
   <production>
      <identifier>A</identifier>=<expression>
         <term>
            <factor>
               <identifier>T</identifier>
            </factor>
         </term>
         <term>
            <factor>
               <identifier>A</identifier>
            </factor>
            <factor>
               <string>"+"</string>
            </factor>
            <factor>
               <identifier>T</identifier>
            </factor>
         </term>
      </expression>.</production>
   <production>
      <identifier>T</identifier>=<expression>
         <term>
            <factor>
               <identifier>F</identifier>
            </factor>
         </term>
         <term>
            <factor>
               <identifier>T</identifier>
            </factor>
            <factor>
               <string>"*"</string>
            </factor>
            <factor>
               <identifier>F</identifier>
            </factor>
         </term>
      </expression>.</production>
   <production>
      <identifier>F</identifier>=<expression>
         <term>
            <factor>
               <identifier>V</identifier>
            </factor>
         </term>
         <term>
            <factor>
               <string>"("</string>
            </factor>
            <factor>
               <identifier>A</identifier>
            </factor>
            <factor>
               <string>")"</string>
            </factor>
         </term>
      </expression>.</production>
   <production>
      <identifier>V</identifier>=<expression>
         <term>
            <factor>
               <string>"a"</string>
            </factor>
         </term>
         <term>
            <factor>
               <string>"b"</string>
            </factor>
         </term>
         <term>
            <factor>
               <string>"c"</string>
            </factor>
         </term>
         <term>
            <factor>
               <string>"d"</string>
            </factor>
         </term>
      </expression>.</production>
</syntax>