[DGD] Re: parse_string() vs. sscanf()

Felix A. Croes felix at dworkin.nl
Thu Feb 19 03:06:33 CET 1998


> > The sscanf() is far more efficient.  The parse_string() version has to:
> >  - parse the grammar
> >  - build a partial DFA for the regular expressions
> >  - build a partial shift/reduce parser for the grammar
> >  - parse the the string according to the grammar
>
> Given this, would it not make sense to be able to do the first three steps
> once, and save it away in a variable so that it then could be used again
> and again without having to rebuild them if other parse trees has been used
> inbetween?

If the state is in a variable, it can either be modified from LPC -- bad --
or I have to make a new type for it.

Use an object to store the state, rather than a variable.  It amounts
to the same thing.

Regards,
Dworkin



More information about the DGD mailing list