weidagang / text-diagram

Text Diagram is a web tool for drawing UML sequence diagram in pure text.
http://weidagang.github.com/text-diagram
316 stars 52 forks source link

Grammar railroad diagram #8

Open mingodad opened 2 years ago

mingodad commented 2 years ago

Looking the grammar at https://github.com/weidagang/text-diagram/blob/master/text-diagram/text-diagram.js and manually converting/simplifying it to an EBNFunderstood by https://www.bottlecaps.de/rr/ui we can get a nice railriad diagram (https://en.wikipedia.org/wiki/Syntax_diagram).

Copy the EBNF shown bellow on https://www.bottlecaps.de/rr/ui at the tab "Edit Grammar" then switch to the tab "View Diagram".

 program ::= statement*
 statement ::= object_declaration | message_statement | note_statement | space_statement
 object_declaration ::= "object" object_id EOS
 message_statement ::= object_id "->" object_id content? EOS
 note_statement ::= side "of" object_id content EOS
 space_statement ::= size
 object_id ::= ([a-z]|[A-Z]|[0-9]|_)+
 content ::= ":" text
 size ::= [0-9]+ //integer
 EOS ::= ';' | '\n' | EOF
dlidstrom commented 1 year ago

@mingodad Fantastic! Thanks for sharing :+1: