Just stumbled over this tweet yesterday -- nice tool:

```
```
The Railroad Diagram Generator has moved to a new home. Please find it at http://t.co/t5SNqmwInX pic.twitter.com/3m3npBPJ2R

— Gunther Rademacher (@__Gunther__) December 4, 2013

Last year I tweeted on JSON spec "number" definition diagram I created by handcompiling to .dot format and using graphviz for layout:

```
```
#abnf #grammar "number" rule from JSON spec (rfc4627) "handcompiled" to "instance generation graph" with annotations http://t.co/KSQ7amkbA0

— H. Stamm-Wilbrandt (@HermannSW) June 4, 2013

OK, I wanted to test that "number" production with Railroad Diagram Generator (RDG).

RDG requires EBNF (Extended Backus-Naur Form) and not ABNF (Augmented Buckus-Naur Form).

I looked at the sample from http://bottlecaps.de/rr/ui in EBNF and copied out ABNF number production from rfc4627:

number = [ minus ] int [ frac ] [ exp ]

decimal-point = %x2E ; .

digit1-9 = %x31-39 ; 1-9

e = %x65 / %x45 ; e E

exp = e [ minus / plus ] 1*DIGIT

frac = decimal-point 1*DIGIT

int = zero / ( digit1-9 *DIGIT )

minus = %x2D ; -

plus = %x2B ; +

zero = %x30 ; 0

After conversion it looks like this (DIGIT from core rules of ABNF spec http://tools.ietf.org/html/rfc5234#appendix-B.1):

number ::= ( minus )? int ( frac )? ( exp )?

decimal-point ::= #x2E

DIGIT ::= #x30 - #x39

digit1-9 ::= #x31 - #x39

e ::= #x65 | #x45

exp ::= e ( minus | plus )? DIGIT+

frac ::= decimal-point DIGIT+

int ::= ( zero | digit1-9 DIGIT* )

minus ::= #x2D

plus ::= #x2B

zero ::= #x30

And that gives a really nice diagram:

http://stamm-wilbrandt.de/en/blog/diagram.xhtml

Hermann _{<myBlog/> <myTweets/> | <GraphvizFiddle/> | <xqib/> | <myCE/> <myFrameless/> | }