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 #16

Open
mingodad opened this issue May 24, 2023 · 0 comments
Open

Grammar railroad diagram #16

mingodad opened this issue May 24, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@mingodad
Copy link

Using some online tools like https://www.bottlecaps.de/rr/ui and https://www.bottlecaps.de/convert/ we can have a nice navigable railroad diagram.

Copy and paste the EBNF shown bellow on https://www.bottlecaps.de/rr/ui on the tab Edit Grammar the click on the tab View Diagram to see/download a navigable railroad diagram.

/* converted on Wed May 24, 2023, 09:27 (UTC+02) by antlr_4-to-w3c v0.64 which is Copyright (c) 2011-2023 by Gunther Rademacher <grd@gmx.net> */

compileUnit
         ::= block* EOF
block    ::= statement
           | sys_set
statement
         ::= attribute
           | set
           | include
attribute
         ::= IDENTIFIER definition
sys_set  ::= IDENTIFIER '[]'? '{' statement* '}'
set      ::= IDENTIFIER? '[]'? ':' typed_set
typed_set
         ::= IDENTIFIER ( '{' statement* '}' | statement+ ';' )
include  ::= ':' IDENTIFIER '"' IDENTIFIER '"' ';'
definition
         ::= '[]'? ( '=' | '\=' ) ( definition_ident | HEX_VALUE | regex | constant_ref | array ) ';'?
definition_ident
         ::= '"'? IDENTIFIER '"'?
array    ::= IDENTIFIER ( ',' IDENTIFIER )+
regex    ::= REGEX
constant_ref
         ::= '$' '$' '{' IDENTIFIER '}'
_        ::= COMMENT
           | WS
           | ENDL
          /* ws: definition */

<?TOKENS?>

REGEX    ::= '(' ( [^()#xa#xd] | '\(' | '\)' | REGEX )* ')' ( '|' | '?' | '*' | '+' )* REGEX?
ESCAPED_BRACKET
         ::= '\('
           | '\)'
IDENTIFIER
         ::= [A-Za-z0-9_.#x2D]+
HEX_VALUE
         ::= '#' [0-9A-Za-z]+
COMMENT? ::= '#' .* #xA
WS       ::= [ #xd#x9]+
ENDL     ::= #xA
UNKNOWN_SYMBOL
         ::= .
EOF      ::= $
@c272 c272 added the enhancement New feature or request label Jun 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants