Confluent Orthogonal Drawings of Syntax Diagrams

  • Michael J. BannisterEmail author
  • David A. Brown
  • David Eppstein
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 9411)


We provide a pipeline for generating syntax diagrams (also called railroad diagrams) from context free grammars. Syntax diagrams are a graphical representation of a context free language, which we formalize abstractly as a set of mutually recursive nondeterministic finite automata and draw by combining elements from the confluent drawing, layered drawing, and smooth orthogonal drawing styles. Within our pipeline we introduce several heuristics that modify the grammar but preserve the language, improving the aesthetics of the final drawing.


  1. 1.
    Jensen, K., Wirth, N.: PASCAL User Manual and Report. Springer, New York (1974)zbMATHGoogle Scholar
  2. 2.
    Burroughs Corporation: Command and Edit (CANDE) Language Information Manual (1971)Google Scholar
  3. 3.
    McCarthy, J.: LISP 1.5 Programmer’s Manual. MIT Press, Cambridge (1965)Google Scholar
  4. 4.
    Braz, L.M.: Visual syntax diagrams for programming language statements. SIGDOC Asterisk J. Comput. Doc. 14, 23–27 (1990)CrossRefGoogle Scholar
  5. 5.
    Bell, S., Gilbert, E.J.: Learning recursion with syntax diagrams. SIGCSE Bull. 6, 44–45 (1974)CrossRefGoogle Scholar
  6. 6.
    Goldberg, A., Robson, D.: Smalltalk-80: The Language and Its Implementation. Addison-Wesley Longman Publishing Co., Inc., Boston (1983)zbMATHGoogle Scholar
  7. 7.
    Crockford, D.: Introducing JSON (2015). Accessed: 04 June 2015
  8. 8.
    Atkins, Jr., T., Sapin, S.: CSS Syntax Module Level 3 (2015). Accessed: 04 June 2015
  9. 9.
    Dopler, M., Schörgenhumer, S.: EBNF Visualizer (2015). Accessed: 04 June 2015
  10. 10.
    Thiemann, P.: Ebnf2ps: Peter’s Syntax Diagram Drawing Tool (2015). Accessed: 04 June 2015
  11. 11.
    Rademacher, G.: Railroad Diagram Generator (2015). Accessed: 04 June 2015
  12. 12.
    Dickerson, M.T., Eppstein, D., Goodrich, M.T., Meng, J.Y.: Confluent drawings: visualizing non-planar diagrams in a planar way. In: Liotta, G. (ed.) GD 2003. LNCS, vol. 2912, pp. 1–12. Springer, Heidelberg (2004) CrossRefGoogle Scholar
  13. 13.
    Sugiyama, K., Tagawa, S., Toda, M.: Methods for visual understanding of hierarchical system structures. IEEE Trans. Systems Man Cybernet. 11, 109–125 (1981)MathSciNetCrossRefGoogle Scholar
  14. 14.
    Bastert, O., Matuszewski, C.: Layered drawings of digraphs. In: Kaufmann, M., Wagner, D. (eds.) Drawing Graphs. LNCS, vol. 2025, pp. 87–120. Springer, Heidelberg (2001) CrossRefGoogle Scholar
  15. 15.
    Bekos, M.A., Kaufmann, M., Kobourov, S.G., Symvonis, A.: Smooth orthogonal layouts. J. Graph Algorithms Appl. 17, 575–595 (2013)MathSciNetCrossRefzbMATHGoogle Scholar
  16. 16.
    Eppstein, D., Goodrich, M.T., Meng, J.Y.: Confluent layered drawings. In: Pach, J. (ed.) GD 2004. LNCS, vol. 3383, pp. 184–194. Springer, Heidelberg (2005) CrossRefGoogle Scholar
  17. 17.
    Hunt III, H.B., Rosenkrantz, D.J., Szymanski, T.G.: On the equivalence, containment, and covering problems for the regular and context-free languages. J. Comput. Syst. Sci. 12, 222–268 (1976)MathSciNetCrossRefzbMATHGoogle Scholar
  18. 18.
    Stockmeyer, L.J., Meyer, A.R.: Word problems requiring exponential time. In: Proceedings 5th ACM Symposium on Theory of Computing (STOC 1973), pp. 1–9 (1973)Google Scholar
  19. 19.
    Gramlich, G., Schnitger, G.: Minimizing NFA’s and regular expressions. J. Comput. Syst. Sci. 73, 908–923 (2007)MathSciNetCrossRefzbMATHGoogle Scholar
  20. 20.
    Champarnaud, J.M., Coulon, F.: NFA reduction algorithms by means of regular inequalities. Theor. Comput. Sci. 327, 241–253 (2004)MathSciNetCrossRefGoogle Scholar
  21. 21.
    Han, Y.S., Wood, D.: Obtaining shorter regular expressions from finite-state automata. Theor. Comput. Sci. 370, 110–120 (2007)MathSciNetCrossRefzbMATHGoogle Scholar

Copyright information

© Springer International Publishing Switzerland 2015

Authors and Affiliations

  • Michael J. Bannister
    • 1
    Email author
  • David A. Brown
    • 1
  • David Eppstein
    • 1
  1. 1.Department of Computer ScienceUniversity of CaliforniaIrvineUSA

Personalised recommendations