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.

Improper grammars

01 Jun 2022

This test set collects some grammars which have various forms of useless rules. Some but not all of these are non-conforming under the current (2022-06-01) rules of ixml.

Note: This test catalog includes alternate results for processors operating in non-standard modes. These are included after the result element, wrapped in an app-info element. The app-info element also contains tc:options elements describing the conditions under which the result holds. Conditions are assumed to be describable by sets of name/value (usually option/setting) pairs, expressed on the options element as attribute-value specifications. If all the option/setting pairs on any options element in the app-info element apply, then any of the results specified in the app-info element is acceptable. (So: for both the options elements and the results in the app-info there is an implicit disjunction: if any of the options elements applies, then any of the results is OK. For the various name/value pairs on an options element, there is an implicit conjunction: the options element applies if ALL of the name/value pairs apply.)

In the current state of this catalog, the only options specified are in the ap:* namespace; these have the local names 'multiple-definitions', 'undefined-symbols', 'unreachable-symbols', and 'unproductive-symbols', with meanings which I hope are obvious. In all cases, the possible values are "error", "warning", and "silence". In non-error cases, the grammar may be rewritten internally to eliminate the problem, but unless the user requests that the compiled grammar be returned, there is really no way to know whether this happens or not.

For strict ixml conformance, the prescribed values are ap:multiple-definitions = "error", ap:undefined-symbols = "error", ap:unreachable-symbols = "warning" or "silence", and ap:unproductive-symbols = "warning" or "silence".

Note that the handling of options is experimental and subject to change without warning. Anyone using this test set who has opinions or suggestions on the right way to handle such options is invited to contact the author.

Note also that a test-case result of assert-not-a-grammar is used here in test cases for what the spec will, I believe, eventually describe as dynamic errors in the grammar, or just as dynamic errors. (Greetings from the past, o future user! If in your world another result is prescribed, like for instance assert-dynamic-error, then you are going to need to update this catalog. The same applies if you want to specify particular error codes to be raised for particular test cases.)

unreachable-2

Created 12 Mar 2022 by cmsmcq

A grammar with two unreachable rules. The rules for B and C are useless because neither symbol is not reachable from S. Their rules can never occur in the successful derivation of a sentence.

A simple check that all nonterminals (with the possible exception of the start symbol) are referred to will not find this problem, because there references to both B and C. To find that they are unreachable, it is necessary to take the transitive closure of the parent/child relation between terminals on the left and right-hand sides of a rule. A nonterminal is reachable if (a) it is the start symbol, or if (b) it occurs on the right-hand side of a rule, and the nonterminal on the left-hand side is reachable.

Invisible XML Grammar


      S = 'a'.
      B = 'b'; '(', C, ')'.
      C = 'c'; '[', B, ']'.
    

Test case: unr-6

Repository URI: …/tests/grammar-misc/test-catalog.xml

Input string (1 character)

b

Expected result

The input does not match the grammar.

Application specific extension

  • Q{http://blackmesatech.com/2019/iXML/Aparecium}unreachable-symbols = error

Expected result

The grammar is invalid. Raises a static error.