Hello Bruce !
You can download the railroad generator to generate offline using Java
here -> https://www.bottlecaps.de/rr/download/rr-1.63-java8.zip (link
from the https://www.bottlecaps.de/rr/ui on tab Welcome).
java -jar rr.war -out:Dafny.atg.xhtml grammar.txt
Cheers !
On 6/7/21 18:51, Bruce Momjian wrote:
On Sat, Jul 3, 2021 at 10:39:02AM +0200, Domingo Alvarez Duarte wrote:
I've done a experimental tool to convert bison grammars to a kind of EBNF
understood by https://www.bottlecaps.de/rr/ui to generate railroad diagrams see
bellow the converted 'postgresql-13.3/src/backend/parser/gram.y' and with some
hand made changes to allow view it at https://www.bottlecaps.de/rr/ui the order
of the rules could be changed to a better view of the railroad diagrams. Copy
and paste the EBNF bellow on https://www.bottlecaps.de/rr/ui tab Edit Grammar
then switch to the tab View Diagram.
That is pretty cool. I had trouble figuring out how to get it working,
so here are the steps I used:
1. save my attachment (created by Domingo)
2. go to https://www.bottlecaps.de/rr/ui
3. select "Edit Grammar"
4. choose "Browse" at the bottom
5. select the attachment you saved in #1
6. choose "Load" at the bottom
7. select "View Diagram"
You can even click on the yellow boxes to see the sub-grammar. People
have asked for railroad diagrams in the past, and this certainly
produces them, and "Options" allows many customizations.
I tried downloading as XHTML+SVG and HTML+PNG but got an error:
HTTP Status 500 – Internal Server Error
Type Exception Report
Message The multi-part request contained parameter data (excluding
uploaded files) that exceeded the limit for maxPostSize set on the
associated connector
Description The server encountered an unexpected condition that
prevented it from fulfilling the request.
It might be nice to download this output and host it on the Postgres
website at some point.