Boost logo

Boost :

From: joel de guzman (djowel_at_[hidden])
Date: 2002-01-17 03:46:29


----- Original Message -----
From: "rogeeff" :
> >
> > It's not the same! Dan's one-liner could parse complex numbers of
> the
> > form:
> >
> > r or (r) or (r, i)
> >
>
> So do i. I just forget ot add parenthesis in the delimeters list.

Still not the same because yours will not be able to
detect erroneous input such as 1)2... etc.

> > Now rewrite that again using tokenizer. Then when you are done,
> > try parsing a vector of comma separated complex numbers where
> > the first number parsed is the size of the vector. Of the form:
> >
> > N { c0, c1, c2, .... cN }
> >
> > With Spirit, this is still a one-liner.
>
> I am not that familiar with regexp syntax but It should also be
> possible to express with one line definition (and if you would talk

Yes you can, but how about the semantics? I mean, extracting
the parsed results? Also, regex cannot be recursive.

> with some of the boost::format guys they would explain to you why
> they regexp implementation: parsing rule can be exported into the
> resource file and changed dynamically)

How complex can it get? That's not simple already.

This sort of contradicts your complexity requirement. The thing
is Spirit can do this elegantly without external code and/or libraries.

Again,

    N { c0, c1, c2, .... cN }

Where c0..cN are complex numbers of the form:

    r or (r) or (r, i)

How can this be parsed correctly with validation and semantics?

--Joel


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