I need to parse this format:

<Database ftpdatabase [hostname[:port]]>
 [<DatabaseID somebody>]
 [<DatabasePWD mypwd>]
 [<Table ftp_users>
  [<Uname uname>]
  [<CryptedPwd cryptedpwd>]
  [<FtpPath ftppath>]
 </Table>]
</Database>

That's all that I currently have.
So, which of these would be the best tool (I know little about any of them).
If anyone gets the urge to just whip out a quick grammar file for me it
would be much appreciated.
Or at least point me to a beginner level tutorial somewhere.

advTHANKSance
	DEJ

Wed, 18 Aug 1999 13:11:47 -0500
"Jackson, DeJuan" <djackson@cpsgroup.com>
[OT] flex, yacc, and bison
"Jackson, DeJuan" <djackson@cpsgroup.com> writes:
> I need to parse this format:
> <Database ftpdatabase [hostname[:port]]>
>  [<DatabaseID somebody>]
>  [<DatabasePWD mypwd>]
>  [<Table ftp_users>
>   [<Uname uname>]
>   [<CryptedPwd cryptedpwd>]
>   [<FtpPath ftppath>]
>  </Table>]
> </Database>

That looks suspiciously like an SGML DTD to me...

Rather than doing the whole lex/yacc bit, I'd suggest finding some
ready-made SGML-parsing tools.  For instance, if you are handy with
Perl I think there are some SGML modules in CPAN ... certainly there
are HTML parsers, which'd probably be easy to adapt to the purpose.

			regards, tom lane

Wed, 18 Aug 1999 16:59:35 -0400
Tom Lane <tgl@sss.pgh.pa.us>
Re: [HACKERS] [OT] flex, yacc, and bison 
Tom Lane <tgl@sss.pgh.pa.us> writes:
> "Jackson, DeJuan" <djackson@cpsgroup.com> writes:
> > I need to parse this format:
> > <Database ftpdatabase [hostname[:port]]>
> >  [<DatabaseID somebody>]
> >  [<DatabasePWD mypwd>]
> >  [<Table ftp_users>
> >   [<Uname uname>]
> >   [<CryptedPwd cryptedpwd>]
> >   [<FtpPath ftppath>]
> >  </Table>]
> > </Database>
> 
> That looks suspiciously like an SGML DTD to me...

Well, it could almost kind of be SGML, but as specified, there's no
way it could possibly be XML (attributes have to have values, a couple
of other things), which is unfortunate, since that's where all the
cool tools are being developed these days.

> Rather than doing the whole lex/yacc bit, I'd suggest finding some
> ready-made SGML-parsing tools.  For instance, if you are handy with
> Perl I think there are some SGML modules in CPAN ... certainly there
> are HTML parsers, which'd probably be easy to adapt to the purpose.

I agree with Tom that you try to find existing parsers tuned towards
this stuff, with the addition that you do your self a favor (if you
have the option to change the format), and change it to be something
that can be parsed as XML.

You don't mention what this is for, but if you're able to move to XML,
you can use Perl (which I personally prefer), Python, TCL, or even one
of several C libraries (expat or rxp or GNOME's libxml) that are
suprisingly easy to use, given that text hacking is not something that
is traditionally easy to do in C.  The possibilities are much broader.

Mike.

18 Aug 1999 17:46:13 -0400
Michael Alan Dorman <mdorman-pgsql.hackers@debian.org>
Re: [HACKERS] [OT] flex, yacc, and bison
Tom Lane wrote:
> 
> "Jackson, DeJuan" <djackson@cpsgroup.com> writes:
> > I need to parse this format:
> > <Database ftpdatabase [hostname[:port]]>
> >  [<DatabaseID somebody>]
> >  [<DatabasePWD mypwd>]
> >  [<Table ftp_users>
> >   [<Uname uname>]
> >   [<CryptedPwd cryptedpwd>]
> >   [<FtpPath ftppath>]
> >  </Table>]
> > </Database>
> 
> That looks suspiciously like an SGML DTD to me...
> 
> Rather than doing the whole lex/yacc bit, I'd suggest finding some
> ready-made SGML-parsing tools.  For instance, if you are handy with
> Perl I think there are some SGML modules in CPAN ... certainly there
> are HTML parsers, which'd probably be easy to adapt to the purpose.

That's definitly not an SGML DTD and it isn't either valid SGML. It will
be hard to find a Perl Module.

-Egon

PS: a small and quick test if my email address is valid

Thu, 19 Aug 1999 00:02:07 +0200
Egon Schmid <eschmid@s.netic.de>
Re: [HACKERS] [OT] flex, yacc, and bison