Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 7D3CA63284C for ; Sat, 17 Jul 2010 04:11:20 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 03239-06 for ; Sat, 17 Jul 2010 07:11:12 +0000 (UTC) X-Greylist: delayed 00:08:28.942354 by SQLgrey-1.7.6 Received: from serenity.inversion.ee (serenity.inversion.ee [194.204.33.112]) by mail.postgresql.org (Postfix) with ESMTP id 37E5063275C for ; Sat, 17 Jul 2010 04:11:13 -0300 (ADT) Received: by serenity.inversion.ee (Postfix, from userid 108) id C7F64E34436; Sat, 17 Jul 2010 08:44:37 +0300 (EEST) Received: from [IPv6:::1] (localhost [127.0.0.1]) by serenity.inversion.ee (Postfix) with ESMTP id C2B71E343A2; Sat, 17 Jul 2010 08:44:36 +0300 (EEST) Subject: Re: Railroad diagrams, a-la sqlite From: Hannu Krosing To: Heikki Linnakangas Cc: Steve Atkins , pgsql-docs In-Reply-To: <4C413FDE.4040501@enterprisedb.com> References: <2AACFC47-C121-4549-B015-AC4FCA9380CE@blighty.com> <4C413FDE.4040501@enterprisedb.com> Content-Type: text/plain; charset="UTF-8" Date: Sat, 17 Jul 2010 10:02:42 +0300 Message-ID: <1279350162.16803.3.camel@hvost> Mime-Version: 1.0 X-Mailer: Evolution 2.28.1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-5 required=5 tests=BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201007/114 X-Sequence-Number: 5770 On Sat, 2010-07-17 at 08:30 +0300, Heikki Linnakangas wrote: > On 17/07/10 07:33, Steve Atkins wrote: > > Has everyone seen the "railroad diagrams" sqlite use in their docs? http://www.sqlite.org/lang_createindex.html , as one example. > > > > Would it be nice to have the same sort of format in the postgresql docs? (Yeah, I'm volunteering, if people think they're a useful thing, 'cos I think they'd add a lot to our documentation.) > > That would be nice. It would have to be automatically generated from the > syntax descriptions we already have, otherwise it'd be unmaintainable. > Also, the text representation would have to still be there in an alt tag > - I note that the the sqlite docs don't have that. > > Any idea how those sqlite images are generated? I have used this: http://www.informatik.uni-freiburg.de/~thiemann/haskell/ebnf2ps/ to make railroad diagrams from postgresql lex/yacc sources a few years ago, when looking into adding WITH support to pg. As it takes extended BNF as input i had to convert pg's lex+yacc into eBNF, which IIRC I did using some python scripts + manual tweaking. > -- > Heikki Linnakangas > EnterpriseDB http://www.enterprisedb.com >