Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2002-10-21 10:23:03


Larry Evans <jcampbell3_at_[hidden]> writes:

> Juan Carlos Arevalo-Baeza wrote:
>
> >On Sat, 19 Oct 2002 11:02:04 -0700, Carl Daniel wrote:
> >
> >
> >>One concern I have, which I belive is based mostly in ignorance, is the
> >>ability of a Spirit-generated parser to perform error recovery and issue
> >>
> >>
> > Try the cpp_grammar test/thingy that I have here:
> >
> >http://home.JCABs-Rumblings.com/ftp/SpiritX/
> >
> [snip]
>
> >for display of the parser call-stack, so to speak, as in:
> >
> >cpp_grammar.cpp:285:9: Error: Expecting '}'
> > cpp_grammar.cpp:284:5: While parsing the member declarator
> > cpp_grammar.cpp:282:14: While parsing member template declaration
> > cpp_grammar.cpp:275:10: While parsing template declaration
> >
> This looks great. What about the possibility of resynchronizing the
> input for the next error message? There are some methods like skipping
> all input to the next, for example, closing paren or curly brace before
> restarting the parse. The purpose of these is to diagnose as many mistakes
> as possible. Does anybody have any ideas about doing this next?

When I was in college Michael Tiemann and I were working on an
incremental compiler compiler project. He was way faster at this than
I was, and actually built an incremental C++ compiler, which AFAIK
eventually became g++. One of the things we talked about was that
there were some techniques for automatically recovering from errors so
that you could resume parsing and provide reasonable error output
further down the line. The authors of this paper said they had tried
this with C++, and some properties of the syntax made effective
recovery nearly impossible... and this was before templates!

-- 
                    David Abrahams
dave_at_[hidden] * http://www.boost-consulting.com
Building C/C++ Extensions for Python: Dec 9-11, Austin, TX
http://www.enthought.com/training/building_extensions.html

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk