[DGD] Working with parse_string()

Felix A. Croes felix at dworkin.nl
Tue Jul 21 13:19:52 CEST 2009


Shentino <shentino at gmail.com> wrote:

> This reminds me of another couple of questions I've wanted to ask:
>
> 1.  Apart from padding a grammar with ambiguity catching error cases, is
> there any way to extract diagnostic information from a bad parse?
>
> So far, I can think of tracking the successful fragment parses as "progress
> points"

Adding rules to handle common errors is what you should do.  Though it
may work for some grammars, in general you can't depend on diagnostic
information gathered in LPC functions called by parse_string(), since
several functions may be called for the same tokens as the parser tries
to fit them to different rules, and there is no guarantee that the last
function called is the most informative one.


> 2.  How do you handle a grammar parse where the grammar, the sentence, or
> both exceed the limits of string size, without hacking DGD and upping the
> limits.

This doesn't make sense.  How do I multiple two numbers, 3 and 4, with
neither number larger than 2?


> A case in point for this would be parsing a very large XML document that was
> larger than 64K

As long as the XML document fits in a string, I don't see why it couldn't
be parsed.

Regards,
Felix Croes



More information about the DGD mailing list