1

I just got linked to the JSON website, and the images stunned me. A better way to intuitively show the flow of a parser I have never seen. Now I want to be able to make these diagrams for my own projects.

First of all, what is this type of diagram called?

Is there a program that can generate these, or am I on my own?

Kevin Brown
  • 36,829
  • 37
  • 188
  • 225
31eee384
  • 2,676
  • 2
  • 14
  • 27
  • 1
    A little bit of googling based on answers shows that these are also called railroad diagrams. Now I have some better terms to use in searching--plenty of good results showing up. – 31eee384 Mar 31 '11 at 18:53

2 Answers2

2

Definitions: http://en.wikipedia.org/wiki/Syntax_diagram

When I googled for Syntax Diagram Tool, there are several listed.

I have some minor experience with the graphvis tool, see their wide ranging gallery at www.graphviz.org/Gallery

I hope this helps.

Bart Kiers
  • 153,868
  • 34
  • 276
  • 272
shellter
  • 33,781
  • 7
  • 75
  • 89
  • Thanks! And a quick google actually points to a question similar to mine, here: http://stackoverflow.com/questions/796824/tool-for-generating-railroad-diagram-used-on-json-org – 31eee384 Mar 31 '11 at 18:41
2

The graphical EBNF editor for ANTLR grammars, ANTLRWorks, automatically generates syntax diagrams of the rules you type.

For example, if you type the following rule (and string and value are also present!):

object 
  :  '{' ((string ':' value) | ',')* '}'
  ;

ANTLRWorks immediately displays the following diagram at the bottom of the page:

enter image description here

which you can enlarge and export in various formats (EPS or bitmap).

Bart Kiers
  • 153,868
  • 34
  • 276
  • 272
  • Awesome! Even better than what I was looking for because the diagram's source is actually the parsing code. – 31eee384 Mar 31 '11 at 18:44