Bnf To Dot

A tool for converting yacc's Backus-Naur rules to GraphViz DOT files. Useful for visualization of BackusNaurForm dependencies.

Does this tool really exist, or is it just a theoretical program?

I wrote my own - about 50 lines of AWK making lots of assumptions about the formatting. It can't be hard.

Got a sample image anywhere?
Not a real good example, but here's most of the ANSI C declaration grammar:

Sweet. Haha! That's what I'm using as the test data - ANSI-C.y, although I didn't group the Flex tokens - instead making them a different color and shape. Your graphs looks cleaner though. . .

I did touch the DOT file by hand in this case. What I did is easy to automate but I didn't bother. It had already served its purpose.

I don't suppose I could request to see your .DOT file?


I'm working on one now in C++, and I'll probably release it once done. I'm not really parsing the BNF as BNF, more just linking the keywords. . .


EditText of this page (last edited July 2, 2004) or FindPage with title or text search