Re: Perl 5.12 complains about ecpg parser-hacking scripts

From: Andy Colson <andy(at)squeakycode(dot)net>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgreSQL(dot)org, meskes(at)postgresql(dot)org, kris(at)shannon(dot)id(dot)au
Subject: Re: Perl 5.12 complains about ecpg parser-hacking scripts
Date: 2011-03-02 19:33:35
Message-ID: 4D6E9B8F.9050707@squeakycode.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 Content-Type Size
parse2.pl text/plain 14.1 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dave Page 2011-03-02 19:38:00 Re: Alpha4 release blockers (was Re: wrapping up this CommitFest)
Previous Message Simon Riggs 2011-03-02 19:28:12 Re: Sync Rep v17