Re: Grammar railroad diagram

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Domingo Alvarez Duarte <mingodad(at)gmail(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Grammar railroad diagram
Date: 2021-07-06 16:51:54
Message-ID: 20210706165154.GA26994@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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.

--
Bruce Momjian <bruce(at)momjian(dot)us> https://momjian.us
EDB https://enterprisedb.com

If only the physical world exists, free will is an illusion.

Attachment Content-Type Size
grammar.txt text/plain 93.0 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Domingo Alvarez Duarte 2021-07-06 16:57:22 Re: Grammar railroad diagram
Previous Message Mark Dilger 2021-07-06 16:38:01 Re: Delegating superuser tasks to new security roles (Was: Granting control of SUSET gucs to non-superusers)