Boost logo

Boost :

From: joel de guzman (isis-tech_at_[hidden])
Date: 2001-05-30 20:16:51


----- Original Message -----
From: "Greg Colvin" <gcolvin_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Thursday, May 31, 2001 12:43 AM
Subject: Re: [boost] Smart pointer status, directions, thoughts

> From: John Max Skaller <skaller_at_[hidden]>
> > Greg Colvin wrote:
> >
> > > Yes, that is just the sort of problem that requires garbage
> > > collection. For better or worse, it is the rare programmer
> > > who sets out to write a language.
> >
> > Actually, most systems DO require programming a 'language'.
> > For example, many applications process configuration files,
> > command line options, and input data. :-)
>
> Like XML, RDF, HTML, SQL ...
>
> And, for worse, many programmers do not approach this
> as a language design task, but just hack up something
> with scanf. I'm hoping tools like Spirit and Felix can
> help.
>

Indeed that was one of the motivations of Spirit. Daily
programming chores necessitate parsing more and more.
Most programmers build parsers by hand even without
realizing it. Many stay away from yacc because of the
'jumbo jet' syndrome [It's just too big and detached
from the application ]. I realized a library based
parser somewhere between regex and a full-blown
parser complete with all the bells and whistles, would
be nifty. Thus Spirit was conceived.

As an aside, barely a week after Spirit was introduced,
people are starting to use it in such applications. In
particular, Bruce Florman sent in a URI parser using
Spirit: and a BNF grammar straight out of appendix
A of RFC 2396.

"To avoid predeclaring all the rules, I needed to reverse
the order, and obviously I had to insert the sequencing
operators and change the notation for optional constructs,
but otherwise the code came straight out of the document."
-Bruce

Here's a sample output from Bruce's test program:

/////////////////////////////////////////////////////////
                A Simple URI Parser ...
/////////////////////////////////////////////////////////
Type a Uniform Resource Identifier (or q to quit) ...
<http://groups.yahoo.com/group/boost/message/12608>
http matched scheme
groups.yahoo.com matched userinfo
groups matched domainlabel
yahoo matched domainlabel
com matched domainlabel
com matched toplabel
groups.yahoo.com matched hostname
groups.yahoo.com matched host
groups.yahoo.com matched hostport
groups.yahoo.com matched server
group matched segment
boost matched segment
message matched segment
12608 matched segment
group/boost/message/12608 matched path_segments
/group/boost/message/12608 matched abs_path
//groups.yahoo.com/group/boost/message/12608
<file://groups.yahoo.com/group/boost/message/12608> matched net_path
//groups.yahoo.com/group/boost/message/12608
<file://groups.yahoo.com/group/boost/message/12608> matched hier_part
<http://groups.yahoo.com/group/boost/message/12608> matched absoluteURI
<http://groups.yahoo.com/group/boost/message/12608> matched URI_reference
                <http://groups.yahoo.com/group/boost/message/12608> parses
OK

Cheers,
Joel de Guzman


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk