Guest User

Untitled

a guest
Mar 7th, 2018
279
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
BNF 1.62 KB | None | 0 0
  1. "Name"     = 'DConfig grammar'
  2.  
  3. "Author"   = 'SiegeLord'
  4.  
  5. "Version"  = '0.1'
  6.  
  7. "About"    = 'Grammar for the DConfig configuration file format'
  8.  
  9.  
  10.  
  11. "Start Symbol" = <Entries>
  12.  
  13.  
  14.  
  15. ! -------------------------------------------------
  16.  
  17. ! Character Sets
  18.  
  19. ! -------------------------------------------------
  20.  
  21.  
  22.  
  23. {UniAlpha} = {Letter} ! And a whole lot of other Unicode characters
  24.  
  25. {IdentifierStart}     = {UniAlpha} + [_]
  26.  
  27. {IdentifierBody}      = {UniAlpha} + {Number} + [_]
  28.  
  29. {Valid}         = {All Valid}
  30.  
  31. {String1 Chars} = {Valid} - ["\]
  32.  
  33. {String2 Chars} = {Valid} - [`\]
  34.  
  35.  
  36.  
  37. ! -------------------------------------------------
  38.  
  39. ! Terminals
  40.  
  41. ! -------------------------------------------------
  42.  
  43.  
  44.  
  45. Identifier    = {IdentifierStart}{IdentifierBody}*
  46.  
  47. StringLiteral1 = '"' ( {String1 Chars} | '\' {Printable} )* '"'
  48.  
  49. StringLiteral2 = '`' ( {String2 Chars} | '\' {Valid} )* '`'
  50.  
  51. Semicolon = ';'
  52.  
  53. LeftBrace = '{'
  54.  
  55. RightBrace = '}'
  56.  
  57.  
  58.  
  59. ! -------------------------------------------------
  60.  
  61. ! Comments
  62.  
  63. ! -------------------------------------------------
  64.  
  65.  
  66.  
  67. Comment Line = '//'
  68.  
  69. Comment Start = '/*'
  70.  
  71. Comment End = '*/'
  72.  
  73.  
  74.  
  75. ! -------------------------------------------------
  76.  
  77. ! Rules
  78.  
  79. ! -------------------------------------------------
  80.  
  81.  
  82.  
  83. <Entries> ::= <Entry> <Entries>
  84.  
  85.            |
  86.  
  87.  
  88.  
  89. <Entry> ::= Identifier <Contents>
  90.  
  91.  
  92.  
  93. <Contents> ::= <Value> <Aggregate>
  94.  
  95.             | <Aggregate>
  96.  
  97.  
  98.  
  99. <Aggregate> ::= <Entry>
  100.  
  101.             |  <Block>
  102.  
  103.             |  Semicolon
  104.  
  105.  
  106.  
  107. <Value> ::= StringLiteral1 | StringLiteral2
  108.  
  109.  
  110.  
  111. <Block> ::= LeftBrace <Entries> RightBrace
Add Comment
Please, Sign In to add comment