[DGD] error reporting with parse_string()

Noah Gibbs noah_gibbs at yahoo.com
Sat Oct 20 08:27:28 CEST 2007


  It's very reasonable to parse large files with parse_string(), and much
faster than the equivalent in LPC.  Phantasmal uses parse_string() as the basis
for all its UNQ parsing.  Error reporting is harder, but possible.  Phantasmal
uses a fairly extensive error stack during its parsing to return lots of error
info, but that only works when the file is basically parseable.  At least one
of the Skotos guys talked about switching to a non-parse_string() parser (or
having a second one?  I forget) in order to have decent error messages...  You
could also do it with a more permissive, or a two-pass, parse_string() grammar.

  Using parse_string to parse LPC is an idea that the Skotos guys use too, I
believe.  I know they parse a sort of enhanced LPC called Merry for their
products, and it's done by parsing LPC+stuff and outputting more LPC.  So yes,
that's definitely possible.  There's an old parse_string() grammar for LPC that
should be on my site somewhere, but it's not quite the same as modern LPC.  A
number of changes have occurred to the language since Dworkin first posted it
years ago.  So it'd be more of a jumping-off point and less of a finished
product.

--- Carter Cheng <carter_cheng at yahoo.com> wrote:

> Thanks everyone  for the help so far. I am not sure if this has been brought
> up before but to what extent is it reasonable to parse large files with
> parse_string()? I have been reading through some of the documentation and
> tutorials and noticed that most of the simple cases described don't cover
> error reporting. I have been wondering if it's possible to write an
> LPCish->LPC compiler with it or is this ill-advised? Does anyone have some
> examples of how to generate error reports for files that may be missing (have
> additional) tokens in the parse stream. Hopefully I am not overloading the
> mailing list with too many queries in a short duration.
> 
> Thanks in advance,
> 
> Carter Cheng.
> 
> 
> 
> 
> ___________________________________________
> https://mail.dworkin.nl/mailman/listinfo/dgd
> 




__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



More information about the DGD mailing list