XML. (was: Re: [ODE] outputting objects)

Anselm Hook anselm at hook.org
Tue Feb 4 13:03:01 2003


Actually using yacc is a good approach - you do end up with a fully
specified parser but it does provide a hands off solution which is what I
am arguing for.

The approach I was using is using lua, and tolua and then lua-xml.

 - a

On Tue, 4 Feb 2003, Martin C. Martin wrote:

>
>
> Anselm Hook wrote:
> >
> > I'd still argue that the point is still not the xml itself - it is that
> > you need some tool to map between *any* notation and C objects.  lets say
> > that you have an xml file:
> >
> >   <ode:body>
> >      <position>0 0 0</position>
> >   </ode:body>
> >
> > how do you pluck out and apply position to the ode object without having
> > to hand write code?  do you write code like this:
> >
> >    for( all xml nodes ) {
> >      if( mode is body )
> >        if( node is position )
> >           body->position = parse_field
> >    }
> >
> > clearly this would be a large mass of messy code.
>
> Yeah, what you really need is a parser generator, like yacc, but that
> generates top down parsers.  Recursive descent parsers would be ideal.
>
> I just use yacc and a lot of copying, and a lex file I got off the web.
> I've included it here.
>
> - Martin