[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grammar railroad diagram #8195

Closed
mingodad opened this issue Dec 26, 2023 · 2 comments
Closed

Grammar railroad diagram #8195

mingodad opened this issue Dec 26, 2023 · 2 comments
Labels

Comments

@mingodad
Copy link

While trying to adapt the grammar shown in https://flatbuffers.dev/flatbuffers_grammar.html to https://mingodad.github.io/parsertl-playground/playground/ an online Yacc/Lex compatible editor/tester (select Flatbuffers parser from Examples then click Parse to see the parser tree for the content in Input source), I found that it is stale.

Would be nice to update it and also change the syntax for the one understood by https://www.bottlecaps.de/rr/ui that allow to generate a nice navigable railroad diagram (see example bellow generated from the grammar in https://mingodad.github.io/parsertl-playground/playground ).

//
// EBNF to be viewd at https://www.bottlecaps.de/rr/ui
//
// Copy and paste this at https://www.bottlecaps.de/rr/ui in the 'Edit Grammar' tab
// then click the 'View Diagram' tab.
//

schema::=
	  include
	| decl
	| schema include
	| schema decl

decl::=
	  namespace_decl
	| type_decl
	| enum_decl
	| union_decl
	| root_decl
	| file_extension_decl
	| file_identifier_decl
	| attribute_decl
	| rpc_decl
	| object

include::=
	  "include" string_constant ';'
	| "native_include" string_constant ';'

namespace_decl::=
	  "namespace" qualident ';'

qualident::=
	  ident
	| qualident '.' ident

attribute_decl::=
	  "attribute" ident ';'
	| "attribute" string_constant ';'

type_decl::=
	  table_or_struct ident metadata_opt '{' field_decl_zom '}'

table_or_struct::=
	  "table"
	| "struct"

enum_decl::=
	  "enum" ident ':' type metadata_opt enum_decl_body

enum_decl_body::=
	  '{' '}'
	| '{' enumval_decl_list '}'
	| '{' enumval_decl_list ',' '}'

union_decl::=
	  "union" ident metadata_opt union_decl_body

union_decl_body::=
	  '{' '}'
	| '{' unionval_decl_list '}'
	| '{' unionval_decl_list ',' '}'

root_decl::=
	  "root_type" ident ';'

field_decl_zom::=
	  /*%empty*/
	| field_decl_zom field_decl

field_decl::=
	  ident ':' type type_assign_opt metadata_opt ';'

type_assign_opt::=
	  /*%empty*/
	| '=' value

rpc_decl::=
	  "rpc_service" ident '{' rpc_method_oom '}'

rpc_method_oom::=
	  rpc_method
	| rpc_method_oom rpc_method

rpc_method::=
	  ident '(' ident ')' ':' ident metadata ';'

type::=
	  "bool"
	| "byte"
	| "ubyte"
	| "short"
	| "ushort"
	| "int"
	| "uint"
	| "float"
	| "long"
	| "ulong"
	| "double"
	| "int8"
	| "uint8"
	| "int16"
	| "uint16"
	| "int32"
	| "uint32"
	| "int64"
	| "uint64"
	| "float32"
	| "float64"
	| "string"
	| '[' type ']'
	| qualident

enumval_decl_list::=
	  enumval_decl
	| enumval_decl_list ',' enumval_decl

enumval_decl::=
	  qualident ident_assign_opt

ident_assign_opt::=
	  /*%empty*/
	| '=' integer_constant

unionval_decl_list::=
	  unionval_decl
	| unionval_decl_list ',' unionval_decl

unionval_decl::=
	  qualident type_opt metadata_opt

type_opt::=
	  /*%empty*/
	| ':' type

metadata_opt::=
	  /*%empty*/
	| metadata

metadata::=
	  '(' key_val_opt_list ')'

key_val_opt_list::=
	  key_val_opt
	| key_val_opt_list ',' key_val_opt

key_val_opt::=
	  ident
	| ident ':' single_value

scalar::=
	  boolean_constant
	| integer_constant
	| float_constant
	| "null"

object::=
	  '{' object_kv_list '}'

object_kv_list::=
	  key_val
	| object_kv_list ',' key_val

key_val::=
	  ident ':' value

single_value::=
	  scalar
	| string_constant

value::=
	  single_value
	| object
	| '[' ']'
	| '[' value_list ']'
	| ident

value_list::=
	  value
	| value_list ',' value

file_extension_decl::=
	  "file_extension" string_constant ';'

file_identifier_decl::=
	  "file_identifier" string_constant ';'
Copy link

This issue is stale because it has been open 6 months with no activity. Please comment or label not-stale, or this will be closed in 14 days.

@github-actions github-actions bot added the stale label Jun 25, 2024
Copy link
github-actions bot commented Jul 9, 2024

This issue was automatically closed due to no activity for 6 months plus the 14 day notice period.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jul 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant