This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/15788] New: Poor error recovery


The attached code shows an error cascade resulting from a missing "}". Now that you have a recursive descent parser, it is near-trivial to repair most bracket errors and missing semis, which together are by far the most common syntax errors. Use a side stack of openers entered and not exited; if you get a closer that does not match the top opener but does match the opener second on the stack, you have a probable missing closer. Synthesize the closer and proceed, and most cascades will go away. The same stack can be used to catch excess closers and missing semis, with reasonable repair so useful compilation can occur after the error is flagged.

Perfect repair is impossible (due to ambiguities), but most cascades can be avoided in practice. Remember to *not* close the scope with a synthesized closer, or if the repair is wrong you will get cascades of "unknow id"s on things declared in the cloed scope.

Now add a lexical nearest-permute matcher to deal with trivial mis-spellings and gcc will at last be usable to fix more than the first error per compilation :-)

Ivan

-- 
           Summary: Poor error recovery
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: igodard at pacbell dot net
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15788


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]