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 Fri Mar 31, 2023, 18:59 (UTC+02) by bison-to-w3c v0.64 which is Copyright (c) 2011-2023 by Gunther Rademacher <grd@gmx.net> */
//From: https://github.com/torsten-rupp/fsmc/blob/main/parser.y
start ::= ( KEYWORD_FSM IDENTIFIER error? ( MULTIPLY? IDENTIFIER '{' statementList '}' )* KEYWORD_END )*
block ::= '{' statementList '}'
statementOrBlock
::= statement
| block
statement
::= variable
| if
| for
| while
| do
| assign
| ( newState | expression ) ';'
| block
statementList
::= statement? statement*
variable ::= type IDENTIFIER ( ASSIGN expression )? ';'
if ::= KEYWORD_IF '(' expression ')' statementOrBlock ( KEYWORD_ELSE statementOrBlock )?
for ::= KEYWORD_FOR '(' expression ';' expression ';' expression ')' statementOrBlock
do ::= KEYWORD_DO statementOrBlock KEYWORD_WHILE '(' expression ')' ';'
while ::= KEYWORD_WHILE '(' expression ')' statementOrBlock
assign ::= expression ASSIGN expression ';'
newState ::= DEREFERENCE IDENTIFIER ( '{' ( STRING ( ',' IDENTIFIER ( ',' number )? )? )? '}' )?
type ::= IDENTIFIER
number ::= INTEGER
| FLOAT
expression
::= '(' expression ')' expression?
| ( MINUS | NOT ) expression
| expression ( ( ASSIGN | PLUS | MINUS | MULTIPLY | DIVIDE | EQUALS | NOT_EQUALS | LOWER | GREATER | LOWER_EQUALS | GREATER_EQUALS | AND | OR | XOR ) expression | INCREMENT | DECREMENT )
| IDENTIFIER ( '(' expression? ( ',' expression )* ')' )?
| STRING
| number
// Tokens
KEYWORD_IF ::= "if"
KEYWORD_ELSE ::= "else"
KEYWORD_FOR ::= "for"
KEYWORD_WHILE ::= "while"
KEYWORD_DO ::= "do"
KEYWORD_FSM ::= "#fsm"
KEYWORD_END ::= "#end"
ASSIGN ::= "="
PLUS ::= "+"
MINUS ::= "-"
MULTIPLY ::= "*"
DIVIDE ::= "/"
INCREMENT ::= "++"
DECREMENT ::= "--"
EQUALS ::= "=="
NOT_EQUALS ::= "!="
LOWER ::= "<"
LOWER_EQUALS ::= "<="
GREATER ::= ">"
GREATER_EQUALS ::= ">="
DEREFERENCE ::= "->"
NOT ::= "!"
AND ::= "&&"
OR ::= "||"
XOR ::= "^"
Using some online tools like https://www.bottlecaps.de/rr/ui and https://www.bottlecaps.de/convert/ and manually adding the tokens from the lexer we can have a nice navigable railroad diagram.
Copy and paste the
EBNF
shown bellow on https://www.bottlecaps.de/rr/ui on the tabEdit Grammar
the click on the tabView Diagram
to see/download a navigable railroad diagram.