Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tool for generating railroad diagram used on json.org [closed]

I love the syntax of railroad diagrams on json.org which are a graphical representation of the BNF language. I haven't found any tools that can produce results as eloquently.

Can anyone identify the tool used to generate these diagrams?

like image 502
aleemb Avatar asked Apr 28 '09 08:04

aleemb


4 Answers

There is an Online Railroad Diagram Generator. It creates SVG syntax diagrams, also known as railroad diagrams, from context-free grammars specified in EBNF. You can copy the SVG code or take screen shots.

You have to type in the grammar and it'll make the diagram.

For example, to create the first railroad diagram you show, you would use the code:

object ::= '{' ((string ':' value ) ( ',' string ':' value )*)? '}'

enter image description here

Then you could go on to define string and value using string ::= ... and value ::= ... The references are all shown.

Check out some of the example diagrams on the page. They have XML and even EBNF itself.

like image 105
Peter Ajtai Avatar answered Nov 07 '22 03:11

Peter Ajtai


from Douglas Crockford
to Aleem B
date Tue, Apr 28, 2009 at 6:01 PM
subject Re: Railroad Diagrams on json.org

I drew them with Visio. Creative Docs.NET also works well.

--

Aleem B wrote:

Hello Douglas,

I thoroughly enjoy most things you put out there and the railroad diagrams on json.org are no different. I have been trying to look around for a tool that would generate diagrams nearly as eloquent but have had no luck:

Tool for generating railroad diagram used on json.org

Is there some tool you used to convert the BNF to these diagrams or were they hand crafted?

-- Aleem

like image 20
aleemb Avatar answered Nov 07 '22 01:11

aleemb


Tab Atkins Jr. created a Javascript Railroad-diagram Generator using svg specifically because he could not find one that had the visual appeal he wanted , i.e. "the JSON.org look".

like image 27
Potherca Avatar answered Nov 07 '22 03:11

Potherca


There was a similar question a few days ago: What is a good tool for creating railroad diagrams?

That question was about how railroad diagrams in the SQLite syntax diagrams were generated. The accepted answer found that the diagrams were generated using a DSL written in Tcl.

Another answer offered a suggestion to use a diagram generator which works off of EBNL grammar.

like image 9
coobird Avatar answered Nov 07 '22 02:11

coobird