Re: Grammar railroad diagram - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: Grammar railroad diagram
Date
Msg-id 20210706165154.GA26994@momjian.us
Whole thread Raw
In response to Grammar railroad diagram  (Domingo Alvarez Duarte <mingodad@gmail.com>)
Responses Re: Grammar railroad diagram
List 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@momjian.us>        https://momjian.us
  EDB                                      https://enterprisedb.com

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


Attachment

pgsql-hackers by date:

Previous
From: Mark Dilger
Date:
Subject: Re: Delegating superuser tasks to new security roles (Was: Granting control of SUSET gucs to non-superusers)
Next
From: Domingo Alvarez Duarte
Date:
Subject: Re: Grammar railroad diagram