[Bug 13298] New: Clean the grammar of unnecessary trivial productions

http://www.w3.org/Bugs/Public/show_bug.cgi?id=13298

           Summary: Clean the grammar of unnecessary trivial productions
           Product: XPath / XQuery / XSLT
           Version: Working drafts
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XQuery 3.0
        AssignedTo: jonathan.robie@gmail.com
        ReportedBy: gabipetrovay@gmail.com
         QAContact: public-qt-comments@w3.org


Hi,

The XQuery 3.0 grammar is full of unnecessary productions. One such example
(out of many) is:
[150] CompElemConstructor ::= "element" (EQName | ("{" Expr "}")) "{"
ContentExpr? "}"
[151] ContentExpr ::= Expr

The ContentExpr translates to Expr and is not referred in the grammar anywhere
else. The Computed Element Desription only mentions about "The content
expression". Just for this, it makes no sense to have an additional
productions.

Having additional unnecessary productions make:
- the grammar too verbose and harder to read
- the implementers not respect the standard because of performace issues when
implementing parsers
- more work to maintain from both W3C and implementers

This should be like in the already existing case of:
[152] CompAttrConstructor ::= "attribute" (EQName | ("{" Expr "}")) "{" Expr?
"}"
where a ContentExpr is not necessary


The only exceptions from this should be the following two because of their
importance and extensive usage:
[38]       QueryBody         ::=       Expr
[125]   VarName              ::=       EQName
[168]   AtomicOrUnionType ::=       EQName
[184]   AttributeName       ::=       EQName
[185]   ElementName       ::=       EQName
[186]   TypeName       ::=       EQName
[191]   URILiteral       ::=       StringLiteral


The same request to remove the trivial production applies to the following:
 [29]       VarValue       ::=       ExprSingle
 [30]       VarDefaultValue       ::=       ExprSingle
-> [28] description can easily make the destinction

 [35]       FunctionBody       ::=       EnclosedExpr

 [56]       CurrentItem       ::=       EQName
 [57]       PreviousItem       ::=       EQName
 [58]       NextItem       ::=       EQName
-> [55] is explicit enough to only have EQName references

 [79]       TryTargetExpr       ::=       Expr

[151]       ContentExpr       ::=       Expr
-> make [150] it uniform with [152]

[154]       Prefix       ::=       NCName
[155]       PrefixExpr       ::=       Expr
[156]       URIExpr       ::=       Expr

[179]       AttributeDeclaration       ::=       AttributeName
-> totally redundant


All this makes the grammar have at least 12 less productions which is not bad.


PS: Or at least make the grammar uniform. Either:
1. Remove all unnecessary productions or
2. Add all missing unnecessary productions

-- 
Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

Received on Tuesday, 19 July 2011 12:55:50 UTC