[XQuery] A.1 EBNF: order of productions

XQuery 1.0: An XML Query Language
W3C Working Draft 12 November 2003

A.1 EBNF

It would be more helpful to the reader if you presented the productions
in an order such that:
(1) The definition for a symbol is close to (and after) its uses (except
    for ubiquitous symbols like ExprSingle and TypeDeclaration).
(2) Definitions for related symbols are close.

Of course, there are tradeoffs involved, but here is an ordering that I
believe fulfills these two desiderata better than the current ordering:

------------------------------------

 [30]  Module
 [36]  VersionDecl
 [31]  MainModule
 [32]  LibraryModule
 [33]  ModuleDecl
 [34]  Prolog
 [35]  Separator
[118]  NamespaceDecl
[115]  XMLSpaceDecl
[119]  DefaultNamespaceDecl
[116]  DefaultCollationDecl
[117]  BaseURIDecl
[146]  SchemaImport
[147]  SchemaPrefix
 [37]  ModuleImport
 [38]  VarDecl
[145]  ValidationDecl
[120]  FunctionDecl
[121]  ParamList
[122]  Param
[114]  EnclosedExpr

 [39]  QueryBody
 [40]  Expr
 [41]  ExprSingle
 [42]  FLWORExpr
 [43]  ForClause
 [44]  PositionalVar
 [45]  LetClause
 [46]  WhereClause
 [47]  OrderByClause
 [48]  OrderSpecList
 [49]  OrderSpec
 [50]  OrderModifier
 [51]  QuantifiedExpr
 [52]  TypeswitchExpr
 [53]  CaseClause
 [54]  IfExpr
 [55]  OrExpr
 [56]  AndExpr
 [57]  InstanceofExpr
 [58]  TreatExpr
 [59]  CastableExpr
 [60]  CastExpr
 [61]  ComparisonExpr
 [82]  GeneralComp
 [83]  ValueComp
 [84]  NodeComp
 [62]  RangeExpr
 [63]  AdditiveExpr
 [64]  MultiplicativeExpr
 [65]  UnaryExpr
 [66]  UnionExpr
 [67]  IntersectExceptExpr
 [68]  ValueExpr
 [78]  ValidateExpr

 [69]  PathExpr
 [70]  RelativePathExpr
 [71]  StepExpr
 [72]  AxisStep
 [85]  ForwardStep
 [89]  ForwardAxis
 [87]  AbbrevForwardStep
 [86]  ReverseStep
 [90]  ReverseAxis
 [88]  AbbrevReverseStep
 [91]  NodeTest
 [92]  NameTest
 [93]  Wildcard
 [73]  FilterStep
 [77]  Predicates

 [75]  PrimaryExpr
 [94]  Literal
 [95]  NumericLiteral
 [76]  VarRef
 [96]  ParenthesizedExpr
 [74]  ContextItemExpr
 [97]  FunctionCall

 [80]  Constructor
 [81]  ComputedConstructor
 [99]  CompDocConstructor
[100]  CompElemConstructor
[101]  CompNSConstructor
[102]  CompAttrConstructor
[105]  CompTextConstructor
[104]  CompXmlComment
[103]  CompXmlPI

 [98]  DirElemConstructor
[110]  AttributeList
[111]  AttributeValue
[112]  QuotAttrValueContent
[113]  AposAttrValueContent
[109]  ElementContent
[108]  XmlComment
[107]  XmlPI
[106]  CdataSection

[124]  SingleType
[123]  TypeDeclaration
[125]  SequenceType
[144]  OccurrenceIndicator
[127]  ItemType
[126]  AtomicType
[128]  KindTest
[141]  AnyKindTest
[138]  DocumentTest
[140]  TextTest
[139]  CommentTest
[137]  PITest
[130]  AttributeTest
[129]  ElementTest
[135]  AttribNameOrWildcard
[134]  ElementNameOrWildcard
[136]  TypeNameOrWildcard
[132]  AttributeName
[131]  ElementName
[133]  TypeName

 [79]  SchemaContext
[143]  SchemaContextLoc
[142]  SchemaContextPath

------------------------------------

 [18]  PITarget
 [20]  VarName

 [12]  SchemaMode
 [13]  SchemaGlobalTypeName
 [14]  SchemaGlobalContext
 [15]  SchemaContextStep

  [7]  IntegerLiteral
  [8]  DecimalLiteral
  [9]  DoubleLiteral
 [16]  Digits
 [10]  StringLiteral
 [22]  PredefinedEntityRef
 [24]  CharRef
 [23]  HexDigits

 [17]  EscapeQuot
 [25]  EscapeApos
 [27]  ElementContentChar
 [28]  QuotAttContentChar
 [29]  AposAttContentChar

  [3]  ExprComment
  [4]  ExprCommentContent
  [1]  Pragma
  [5]  PragmaContents
  [2]  MUExtension
  [6]  ExtensionContents

 [21]  QName
 [19]  NCName
 [11]  S
 [26]  Char

------------------------------------

-Michael Dyck

Received on Sunday, 15 February 2004 16:14:07 UTC