From 5a40295c4cf0af5ea8da9ced04a4ce7d3621a080 Mon Sep 17 00:00:00 2001 From: Toni Uhlig Date: Sun, 16 Jul 2023 02:03:33 +0200 Subject: Squashed 'flatcc/' content from commit 473da2a git-subtree-dir: flatcc git-subtree-split: 473da2afa5ca435363f8c5e6569167aee6bc31c5 --- doc/Grammar-2015-07-23.md | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 doc/Grammar-2015-07-23.md (limited to 'doc/Grammar-2015-07-23.md') diff --git a/doc/Grammar-2015-07-23.md b/doc/Grammar-2015-07-23.md new file mode 100644 index 0000000..cafc054 --- /dev/null +++ b/doc/Grammar-2015-07-23.md @@ -0,0 +1,42 @@ +# Formal Grammar of the schema language + +schema = include* + ( namespace\_decl | type\_decl | enum\_decl | root\_decl | + file_extension_decl | file_identifier_decl | + attribute\_decl | object )* + +include = `include` string\_constant `;` + +namespace\_decl = `namespace` ident ( `.` ident )* `;` + +attribute\_decl = `attribute` string\_constant `;` + +type\_decl = ( `table` | `struct` ) ident metadata `{` field\_decl+ `}` + +enum\_decl = ( `enum` | `union` ) ident [ `:` type ] metadata `{` commasep( +enumval\_decl ) `}` + +root\_decl = `root_type` ident `;` + +field\_decl = ident `:` type [ `=` scalar ] metadata `;` + +type = `bool` | `byte` | `ubyte` | `short` | `ushort` | `int` | `uint` | +`float` | `long` | `ulong` | `double` + | `string` | `[` type `]` | ident + +enumval\_decl = ident [ `=` integer\_constant ] + +metadata = [ `(` commasep( ident [ `:` scalar ] ) `)` ] + +scalar = integer\_constant | float\_constant | `true` | `false` + +object = { commasep( ident `:` value ) } + +value = scalar | object | string\_constant | `[` commasep( value ) `]` + +commasep(x) = [ x ( `,` x )\* ] + +file_extension_decl = `file_extension` string\_constant `;` + +file_identifier_decl = `file_identifier` string\_constant `;` + -- cgit v1.2.3