Boost logo

Boost :

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


From: "joel de guzman":
>
> 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
>

"...output lines, like "groups.yahoo.com matched userinfo" and "com matched
domainlabel"
reflect actions from productions that were subsequently backtracked over.
Obviously
if I want to really create an object representing a parsed URL, I need to
arrange that
nothing be "committed" until the parse completes altogether..."
-Bruce

Valid points re: semantic actions and backtracking in Spirit.
This was first noted by Larry Evans.
I am tackling the issue now in the form of Contexts.

-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