What is a good tool for creating railroad diagrams

2019-01-16 15:20发布

I was very impressed by sqlite's syntax diagrams and was wondering if anyone could recommend software which would let me create similar graphs.

9条回答
Fickle 薄情
2楼-- · 2019-01-16 15:24

I don't know any specific tools, but I can tell you they're often referred to as Recursive Transition Networks (RTNs). So you may be able to use this to expand your search.

You might also be able to get a response from the SQLite mailing list and find out exactly what they use.

查看更多
再贱就再见
3楼-- · 2019-01-16 15:25

If you use EBNF for your syntax, there is the EBNF Visualizer for this purpose.

You can also try Graphviz. It is open source and their exist several GUI tools for working with it. It is mostly useful for generic graphs but it can be adapted for syntax graphs too.

Another free tool called SYNGEN also exists.

查看更多
冷血范
5楼-- · 2019-01-16 15:25

I use OpenOffice Draw for many of my drawing needs. Free, open-source, and multiplatform are the big things for me. It does a great job on flow charts with a small learning curve.

I've used SmartDraw before and found it very capable but my need for

查看更多
爷、活的狠高调
6楼-- · 2019-01-16 15:26

(Sorry I do not have enough rep to simply add a comment on an answer)

On the accepted answer : Go to Line 1035 and simply alter the file extension for the output from “gif” go “png”, which will create an antialiased picture in PNG-format.

Also on my system “xv” is not available, simply comment it away (line 1036, following):

if 0 {
  if {$do_xv} {
    exec xv $name.gif &
  }
}

cheers

查看更多
ら.Afraid
7楼-- · 2019-01-16 15:33

It looks like they wrote their own script for generating these, as a little embedded DSL in TCL. You might be able to re-purpose their script.

edit: Yep, it's pretty easy to use, though it looks like it'll take a little tweaking to make the output prettier (for some reason, convert is failing to antialias this on my system; the postscript output looks nice).

alt text

hello {                                                                       
  line HELLO {or WORLD {line MY FRIEND {opt ANDREY}} }                      
}

edit 2: Here's a brief article on how this works, along with some notes on how to log in anonymously to view the source if you can't see it immediately.

查看更多
登录 后发表回答