-
Notifications
You must be signed in to change notification settings - Fork 13
Description
The spec doesn't mention prioritisation of rules or how precedence is to be determined. This means that when I have rules that are ambiguous:
- I can't predict or influence which rule will take precedence over another
- Results are inconsistent across parsers
To illustrate point 2, see karaoke_ixml.zip which contains:
- an iXML grammar
- a sample input file
- the XML generated by several iXML processors using those two inputs
The processors compared are:
- Markup Blitz 1.9
- NineML via XML Calabash 3.0.20
- Agence XML's Invisible XML Tester
- jωIXML
- ixampl
No two processors returned the matching results.
Even if implementations were to continue implementing their own logic for precedence, as a grammar author it would be helpful to be able to specify which rule I expect take priority over another. So that, for example, to disambiguate the following grammar:
song-list: group+ .
group: (artists, songs) .
songs: song+ .
artists: text, line-ending .
song: text, multiplex?, code, line-ending .
@multiplex: -" (Multiplex)", +"true" .
@code: -" ", [Lu], [Lu], [Nd], [Nd], [Nd], [Nd], [Nd] .
-text: (word, " ")*, word .
-word: [L; N; P; Sc]* .
-line-ending: (-#a; -#d) .
I could specify that:
- the
songrule is a higher priority than theartistsrule - the
codeandmultiplexrules are a higher priority than thetextrule
Because although Exhale (Shoop Shoop) (Multiplex) MH04561 matches both the artists and song rules, if a processor isn't going to attempt to disambiguate them by, for example, giving precedence to the rule that has the most factors, then I would like it to choose song over artists because of the priorities I specified. In the example I've provided above, that first priority rule would probably make the second redundant but extra layers of priority might be relevant in a more complex grammar.