Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1apqb0-0002Th-Vz for pgsql-hackers@arkaria.postgresql.org; Tue, 12 Apr 2016 05:10:39 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1apqaz-0005BF-Si for pgsql-hackers@arkaria.postgresql.org; Tue, 12 Apr 2016 05:10:37 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1apqaz-0005B8-9X for pgsql-hackers@postgresql.org; Tue, 12 Apr 2016 05:10:37 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1apqaw-00007I-1N for pgsql-hackers@postgresql.org; Tue, 12 Apr 2016 05:10:36 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id u3C5AV6H005689; Tue, 12 Apr 2016 01:10:31 -0400 From: Tom Lane To: Arcadiy Ivanov cc: pgsql-hackers@postgresql.org Subject: Re: Parser extensions (maybe for 10?) In-reply-to: <570C7B5A.9070309@gmail.com> References: <570C7B5A.9070309@gmail.com> Comments: In-reply-to Arcadiy Ivanov message dated "Tue, 12 Apr 2016 00:36:42 -0400" Date: Tue, 12 Apr 2016 01:10:31 -0400 Message-ID: <5688.1460437831@sss.pgh.pa.us> X-Pg-Spam-Score: -2.9 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Arcadiy Ivanov writes: > Is there any interest and/or tips to allow a pluggable parser or at > least allow some syntactical pluggability by extensions? There is a fair amount of discussion of this in the archives. The short answer is that bison can't do it, and "let's replace bison" is a proposal with a steep hill in front of it --- the pain-to-gain ratio is just not very favorable. Forty years ago, I worked on systems with extensible parsers at HP, wherein plug-in extensions could add clauses very similarly to what you suggest. Those designs worked, more or less, but they had a lot of deficiencies; the most fundamental problem being that any parsing inconsistencies would only appear through misbehavior at runtime, which you would only discover if you happened to test a case that behaved oddly *and* notice that it was not giving the result you expected. Bison is far from perfect on this angle, because %prec declarations can produce results you weren't expecting ... but it's at least one order of magnitude better than any extensible-parser solution I've ever seen. Usually bison will give you a shift/reduce error if you write something that has more than one possible interpretation. I'm interested in possible solutions to this problem, but it's far harder than it looks. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers