Skip to content

Grammar railroad diagram #16

Description

@mingodad

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      ::= $

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions