Re: Perl 5.12 complains about ecpg parser-hacking scripts - Mailing list pgsql-hackers

From Andy Colson
Subject Re: Perl 5.12 complains about ecpg parser-hacking scripts
Date
Msg-id 4D6E9B8F.9050707@squeakycode.net
Whole thread Raw
In response to Re: Perl 5.12 complains about ecpg parser-hacking scripts  (Michael Meskes <meskes@postgresql.org>)
Responses Re: Perl 5.12 complains about ecpg parser-hacking scripts
Re: Perl 5.12 complains about ecpg parser-hacking scripts
Re: Perl 5.12 complains about ecpg parser-hacking scripts
List pgsql-hackers
On 1/23/2011 5:11 AM, Michael Meskes wrote:
> On Sat, Jan 22, 2011 at 08:40:13PM -0500, Andrew Dunstan wrote:
>> I think these really need to be rewritten from scratch. They look
>> like they were written by someone who never heard of Perl 5 (it's
>> only about 16 years old).
>
> You might remember that we had this discussion before. The script was written
> in awk and then translated to perl by a2p. We knew that this code was less than
> optimal, but at least it works.
>
> As I already said when the script was introduced, I would love to have a real
> perl solution, but I'm not a perl programmer by any means.
>
> Michael

I thought Kris was going to work on this, but saw no progress, and I was
bored the other day, so I started working on it.

Here is a parse.pl, with some major refactoring.

I named it with a 2 so I could run it beside the original and diff em:

time perl parse.pl  . < ../../../backend/parser/gram.y > preproc.y

real    0m10.636s
user    0m8.793s
sys     0m0.050s


time perl  parse2.pl  . < ../../../backend/parser/gram.y > preproc2.y

real    0m0.289s
user    0m0.214s
sys     0m0.009s


diff preproc.y preproc2.y

I am sure there are new bugs.  I have not run it on anything but 9.0.1.
  Are there other .y files you might feed it? (something other than
backend/parser/gram.y?)

I touched pretty much everything, and I broke a few things and had to go
back and fix 'em, so it would not surprise me at all if there were still
a few bugs.

Anyway, feedback, suggestions, etc are welcomed.  (oh, yeah, I probably
need to go add some documentation)

-Andy

Attachment

pgsql-hackers by date:

Previous
From: Simon Riggs
Date:
Subject: Re: Sync Rep v17
Next
From: Dave Page
Date:
Subject: Re: Alpha4 release blockers (was Re: wrapping up this CommitFest)