Unix Technical Forum

ISO TESTS for a Pg lexer+parser

This is a discussion on ISO TESTS for a Pg lexer+parser within the Pgsql General forums, part of the PostgreSQL category; --> Hi! I am in the process of writing a PostgreSQL lexer/parser in Perl, because everything else I've found in ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > Pgsql General

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-09-2008, 06:16 PM
Kynn Jones
 
Posts: n/a
Default ISO TESTS for a Pg lexer+parser

Hi! I am in the process of writing a PostgreSQL lexer/parser in Perl,
because everything else I've found in this area is too buggy. I'm
basing this lexer/parser on the lexer and parser encoded respectively
in scan.l and gram.y under src/backend/parser.

I'm looking for a solid collection of test cases to test my
lexer/parser. (I'm hoping that such a collection has already been
produced to test the PostgreSQL yacc-generated parser that comes with
the PostgreSQL distribution.)

(Alternatively, if a non-flaky, rock-solid, and easily customizable Pg
parser in Perl already exists please let me know.)

TIA!

kj

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-09-2008, 06:16 PM
Stephen Frost
 
Posts: n/a
Default Re: ISO TESTS for a Pg lexer+parser

* Kynn Jones (kynnjo@gmail.com) wrote:
> Hi! I am in the process of writing a PostgreSQL lexer/parser in Perl,
> because everything else I've found in this area is too buggy. I'm
> basing this lexer/parser on the lexer and parser encoded respectively
> in scan.l and gram.y under src/backend/parser.
>
> I'm looking for a solid collection of test cases to test my
> lexer/parser. (I'm hoping that such a collection has already been
> produced to test the PostgreSQL yacc-generated parser that comes with
> the PostgreSQL distribution.)
>
> (Alternatively, if a non-flaky, rock-solid, and easily customizable Pg
> parser in Perl already exists please let me know.)


Two things, one, couldn't you just make the lexer/parser in PG into a
C library and then write bindings for it for use under Perl? Seems like
that'd be more sane. Second, PG's got a regression test suite that
would probably work decently for testing your lexer/parser. You might
have to filter out '\' commands, if there are any, and things like that.

Enjoy,

Stephen

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFGjpf8rzgMPqB3kigRAvBcAJoC4RjVK050zvSqrMB/LiNRbMtWBQCgkP9L
RcYlxnv9WlSIUpHoLETWKpw=
=DuFd
-----END PGP SIGNATURE-----

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-09-2008, 06:16 PM
Dann Corbit
 
Posts: n/a
Default Re: ISO TESTS for a Pg lexer+parser

This stuff:
/postgresql-8.2.4/src/test/regress/sql
Should do for starters.

> -----Original Message-----
> From: pgsql-general-owner@postgresql.org [mailtogsql-general-
> owner@postgresql.org] On Behalf Of Kynn Jones
> Sent: Friday, July 06, 2007 12:15 PM
> To: pgsql-general@postgresql.org
> Subject: [GENERAL] ISO TESTS for a Pg lexer+parser
>
> Hi! I am in the process of writing a PostgreSQL lexer/parser in Perl,
> because everything else I've found in this area is too buggy. I'm
> basing this lexer/parser on the lexer and parser encoded respectively
> in scan.l and gram.y under src/backend/parser.
>
> I'm looking for a solid collection of test cases to test my
> lexer/parser. (I'm hoping that such a collection has already been
> produced to test the PostgreSQL yacc-generated parser that comes with
> the PostgreSQL distribution.)
>
> (Alternatively, if a non-flaky, rock-solid, and easily customizable Pg
> parser in Perl already exists please let me know.)
>
> TIA!
>
> kj
>
> ---------------------------(end of

broadcast)---------------------------
> TIP 6: explain analyze is your friend


---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

http://archives.postgresql.org/

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-09-2008, 06:17 PM
Bruce Momjian
 
Posts: n/a
Default Re: ISO TESTS for a Pg lexer+parser

Stephen Frost wrote:
-- Start of PGP signed section.
> * Kynn Jones (kynnjo@gmail.com) wrote:
> > Hi! I am in the process of writing a PostgreSQL lexer/parser in Perl,
> > because everything else I've found in this area is too buggy. I'm
> > basing this lexer/parser on the lexer and parser encoded respectively
> > in scan.l and gram.y under src/backend/parser.
> >
> > I'm looking for a solid collection of test cases to test my
> > lexer/parser. (I'm hoping that such a collection has already been
> > produced to test the PostgreSQL yacc-generated parser that comes with
> > the PostgreSQL distribution.)
> >
> > (Alternatively, if a non-flaky, rock-solid, and easily customizable Pg
> > parser in Perl already exists please let me know.)

>
> Two things, one, couldn't you just make the lexer/parser in PG into a
> C library and then write bindings for it for use under Perl? Seems like
> that'd be more sane. Second, PG's got a regression test suite that
> would probably work decently for testing your lexer/parser. You might
> have to filter out '\' commands, if there are any, and things like that.


Ditto. Also consider that the grammer changes in every major PostgreSQL
release.

--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://www.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 04-09-2008, 06:28 PM
Kynn Jones
 
Posts: n/a
Default Re: ISO TESTS for a Pg lexer+parser

On 7/6/07, Stephen Frost <sfrost@snowman.net> wrote:
> * Kynn Jones (kynnjo@gmail.com) wrote:
> > Hi! I am in the process of writing a PostgreSQL lexer/parser in Perl,
> > because everything else I've found in this area is too buggy. I'm
> > basing this lexer/parser on the lexer and parser encoded respectively
> > in scan.l and gram.y under src/backend/parser.
> >
> > I'm looking for a solid collection of test cases to test my
> > lexer/parser. (I'm hoping that such a collection has already been
> > produced to test the PostgreSQL yacc-generated parser that comes with
> > the PostgreSQL distribution.)


> ...PG's got a regression test suite that
> would probably work decently for testing your lexer/parser.


I found a test suite under

src/test/regress

(thanks to Dann Corbit for the path), but as far as I can tell those
tests exercise only the parser. Maybe the authors figured that the
lexer would be tested sufficiently, albeit indirectly, through the
tests of the parser?

If I've missed something, I'd be very grateful if someone could tell
me which files in this test suite are devoted to testing the lexer
specifically.

TIA!

kj

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 05:25 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com