Re: Error reporting, was Infinite look ahead required by C++?

Hans Aberg <haberg_20080406@math.su.se>
Tue, 16 Feb 2010 18:37:39 +0100

          From comp.compilers

Related articles
Infinite look ahead required by C++? ng2010@att.invalid (ng2010) (2010-02-05)
Re: Infinite look ahead required by C++? idbaxter@semdesigns.com (Ira Baxter) (2010-02-06)
Re: Infinite look ahead required by C++? cfc@shell01.TheWorld.com (Chris F Clark) (2010-02-10)
Re: Infinite look ahead required by C++? idbaxter@semdesigns.com (Ira Baxter) (2010-02-13)
Re: Infinite look ahead required by C++? wclodius@los-alamos.net (2010-02-13)
Re: Error reporting, was Infinite look ahead required by C++? sh006d3592@blueyonder.co.uk (Stephen Horne) (2010-02-14)
Re: Error reporting, was Infinite look ahead required by C++? idbaxter@semdesigns.com (Ira Baxter) (2010-02-15)
Re: Error reporting, was Infinite look ahead required by C++? haberg_20080406@math.su.se (Hans Aberg) (2010-02-16)
Re: Error reporting, was Infinite look ahead required by C++? sh006d3592@blueyonder.co.uk (Stephen Horne) (2010-02-17)
Re: Error reporting, was Infinite look ahead required by C++? kkylheku@gmail.com (Kaz Kylheku) (2010-02-17)
Re: Error reporting, was Infinite look ahead required by C++? haberg_20080406@math.su.se (Hans Aberg) (2010-02-19)
Re: Error reporting, was Infinite look ahead required by C++? jdenny@clemson.edu (Joel E. Denny) (2010-02-19)
Re: Error reporting, was Infinite look ahead required by C++? cfc@shell01.TheWorld.com (Chris F Clark) (2010-02-19)
Re: Error reporting, was Infinite look ahead required by C++? cfc@shell01.TheWorld.com (Chris F Clark) (2010-02-19)
[5 later articles]
| List of all articles for this month |
From: Hans Aberg <haberg_20080406@math.su.se>
Newsgroups: comp.compilers
Date: Tue, 16 Feb 2010 18:37:39 +0100
Organization: A noiseless patient Spider
References: 10-02-024 10-02-029 10-02-047 10-02-055 10-02-062 10-02-064
Keywords: errors, LALR
Posted-Date: 16 Feb 2010 19:14:23 EST

Stephen Horne wrote:
> In LR(1), it is *easy* to give a message of the form "expected one of
> <token list>, but <token> was found." - the set of possible next
> tokens is part of the description of each state, and this can easily
> be traced back to a set of productions (or else the parser could never
> know when/what to reduce).
>
> Yacc and Bison don't support reporting errors in this form AFAIK, but
> the tool isn't the same as the algorithm the tool uses.


Those use LALR(1), though LR(1) support may be in the works for Bison,
which compacts the states in such a way that when an error token
appears, some extra reductions may take place before issuing the error.
It means that one must implement some search technique to get it right
if sticking to an algorithm doing such kind of compaction.


Unfortunately, what is actually implemented as LR(1) may in reality not
be pure, but applying a similar state compaction technique, with the
focus on covering the larger language class, having the same error
reporting problem. It is unclear though what this means in practice.


      Hans


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.