[DGD] Working with parse_string()

Shentino shentino at gmail.com
Wed Jul 22 00:21:45 CEST 2009


My first guess is that rules are called left to right among equally deep
parts, parts before wholes, and alternatives sorted by vertical order of the
first rule to differ.

Order of the rules:  Accounted for by making it the tie breaker between
alternatives
Recursion:  Parts before wholes
Ambiguity:  Ties broken by whichever rule differs first, then which rule is
first in the grammer.  Kinda like alphabetizing.

That is my guess.

On Tue, Jul 21, 2009 at 5:29 AM, Felix A. Croes <felix at dworkin.nl> wrote:

> Shentino <shentino at gmail.com> wrote:
>
> >[...]
> > > 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.
> >
> >
> > Are there any guarantees about which order they will be called in?
>
> Tell you what -- why don't you come up with an order in which functions
> should be called that takes into account the order of rules in the
> grammar, recursion and ambiguity, and then I'll let you know if it is
> the one that parse_string() uses.
>
> Regards,
> Felix Croes
> ___________________________________________
> https://mail.dworkin.nl/mailman/listinfo/dgd
>



More information about the DGD mailing list