We provide a framework for generating syntax diagrams (also called railroad diagrams) for context-free grammars. Syntax diagrams are a graphical representation of a context-free grammar, similar to how a drawing of an NFA is a graphical representation of a regular gram- mar. The typical style used when drawing syntax diagrams is based on confluent orthogonal drawing. We provide several heuristic to optimize the drawings of the syntax diagrams produced within our framework.
Joint work with David Brown and David Eppstein