[2509.15834] Automatic layout of railroad diagrams
Skip to main content
arXiv is now an independent nonprofit!<br>Learn more<br>×
Search arXiv
Press Enter to search · Advanced search
-->
Computer Science > Programming Languages
arXiv:2509.15834 (cs)
[Submitted on 19 Sep 2025]
Title:Automatic layout of railroad diagrams
Authors:Shardul Chiplunkar, Clément Pit-Claudel<br>View a PDF of the paper titled Automatic layout of railroad diagrams, by Shardul Chiplunkar and 1 other authors
View PDF<br>HTML (experimental)
Abstract:Railroad diagrams (also called "syntax diagrams") are a common, intuitive visualization of grammars, but limited tooling and a lack of formal attention to their layout mostly confines them to hand-drawn documentation. We present the first formal treatment of railroad diagram layout along with a principled, practical implementation. We characterize the problem as compiling a *diagram language* (specifying conceptual components and how they connect and compose) to a *layout language* (specifying basic graphical shapes and their sizes and positions). We then implement a compiler that performs *line wrapping* to meet a target width, as well as vertical *alignment* and horizontal *justification* per user-specified policies. We frame line wrapping as an optimization problem, where we describe principled dimensions of optimality and implement corresponding heuristics. For front-end evaluation, we show that our diagram language is well-suited for common applications by describing how regular expressions and Backus-Naur form can be compiled to it. For back-end evaluation, we argue that our compiler is practical by comparing its output to diagrams laid out by hand and by other tools.
Comments:<br>24 pages (+2 appendix, +3 references); 22 figures (+4 appendix); 3 tables
Subjects:
Programming Languages (cs.PL)
Cite as:<br>arXiv:2509.15834 [cs.PL]
(or<br>arXiv:2509.15834v1 [cs.PL] for this version)
https://doi.org/10.48550/arXiv.2509.15834
Focus to learn more
arXiv-issued DOI via DataCite
Submission history<br>From: Shardul Chiplunkar [view email]<br>[v1]<br>Fri, 19 Sep 2025 10:13:03 UTC (1,880 KB)
Full-text links:<br>Access Paper:
View a PDF of the paper titled Automatic layout of railroad diagrams, by Shardul Chiplunkar and 1 other authors<br>View PDF<br>HTML (experimental)<br>TeX Source
view license
Current browse context:
cs.PL
next >
new<br>recent<br>| 2025-09
Change to browse by:
cs
References & Citations
NASA ADS<br>Google Scholar
Semantic Scholar
export BibTeX citation<br>Loading...
BibTeX formatted citation
×
loading...
Data provided by:
Bookmark
Bibliographic Tools
Bibliographic and Citation Tools
Bibliographic Explorer Toggle
Bibliographic Explorer (What is the Explorer?)
Connected Papers Toggle
Connected Papers (What is Connected Papers?)
Litmaps Toggle
Litmaps (What is Litmaps?)
scite.ai Toggle
scite Smart Citations (What are Smart Citations?)
Code, Data, Media
Code, Data and Media Associated with this Article
alphaXiv Toggle
alphaXiv (What is alphaXiv?)
Links to Code Toggle
CatalyzeX Code Finder for Papers (What is CatalyzeX?)
DagsHub Toggle
DagsHub (What is DagsHub?)
GotitPub Toggle
Gotit.pub (What is GotitPub?)
Huggingface Toggle
Hugging Face (What is Huggingface?)
ScienceCast Toggle
ScienceCast (What is ScienceCast?)
Demos
Demos
Replicate Toggle
Replicate (What is Replicate?)
Spaces Toggle
Hugging Face Spaces (What is Spaces?)
Spaces Toggle
TXYZ.AI (What is TXYZ.AI?)
Related Papers
Recommenders and Search Tools
Link to Influence Flower
Influence Flower (What are Influence Flowers?)
Core recommender toggle
CORE Recommender (What is CORE?)
Author
Venue
Institution
Topic
About arXivLabs
arXivLabs: experimental projects with community collaborators
arXivLabs is a framework that allows collaborators to develop and share new arXiv features directly on our website.
Both individuals and organizations that work with arXivLabs have embraced and accepted our values of openness, community, excellence, and user data privacy. arXiv is committed to these values and only works with partners that adhere to them.
Have an idea for a project that will add value for arXiv's community? Learn more about arXivLabs .
Which authors of this paper are endorsers? |<br>Disable MathJax (What is MathJax?)
Major funding support from