nostrdb

an unfairly fast embedded nostr database backed by lmdb
git clone git://jb55.com/nostrdb
Log | Files | Refs | Submodules | README | LICENSE

Grammar-2015-07-23.md (1226B)


      1 # Formal Grammar of the schema language
      2 
      3 schema = include*
      4          ( namespace\_decl | type\_decl | enum\_decl | root\_decl |
      5            file_extension_decl | file_identifier_decl |
      6            attribute\_decl | object )*
      7 
      8 include = `include` string\_constant `;`
      9 
     10 namespace\_decl = `namespace` ident ( `.` ident )* `;`
     11 
     12 attribute\_decl = `attribute` string\_constant `;`
     13 
     14 type\_decl = ( `table` | `struct` ) ident metadata `{` field\_decl+ `}`
     15 
     16 enum\_decl = ( `enum` | `union` ) ident [ `:` type ] metadata `{` commasep(
     17 enumval\_decl ) `}`
     18 
     19 root\_decl = `root_type` ident `;`
     20 
     21 field\_decl = ident `:` type [ `=` scalar ] metadata `;`
     22 
     23 type = `bool` | `byte` | `ubyte` | `short` | `ushort` | `int` | `uint` |
     24 `float` | `long` | `ulong` | `double`
     25  | `string` | `[` type `]` | ident
     26 
     27 enumval\_decl = ident [ `=` integer\_constant ]
     28 
     29 metadata = [ `(` commasep( ident [ `:` scalar ] ) `)` ]
     30 
     31 scalar = integer\_constant | float\_constant | `true` | `false`
     32 
     33 object = { commasep( ident `:` value ) }
     34 
     35 value = scalar | object | string\_constant | `[` commasep( value ) `]`
     36 
     37 commasep(x) = [ x ( `,` x )\* ]
     38 
     39 file_extension_decl = `file_extension` string\_constant `;`
     40 
     41 file_identifier_decl = `file_identifier` string\_constant `;`
     42