From: | Stephen Horne <sh006d3592@blueyonder.co.uk> |
Newsgroups: | comp.compilers |
Date: | Wed, 17 Feb 2010 01:44:59 +0000 |
Organization: | virginmedia.com |
References: | 10-02-024 10-02-029 10-02-047 10-02-055 10-02-062 10-02-064 10-02-070 |
Keywords: | errors, parse |
Posted-Date: | 19 Feb 2010 01:45:24 EST |
On Tue, 16 Feb 2010 18:37:39 +0100, Hans Aberg
<haberg_20080406@math.su.se> wrote:
>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,
Just making sure I haven't misunderstood...
LALR(1) is basically a minor variation of LR(1). The derivation of the
state model is a little different, but each state still has a set of
valid next tokens, used to choose between shifting and reducing.
>which compacts the states in such a way that when an error token
>appears, some extra reductions may take place before issuing the error.
This sounds like table compression modified by some form of
preprocessing of the state model, but it doesn't sound like an
inherent part of LALR, but rather an optimisation specific to Bison?
Return to the
comp.compilers page.
Search the
comp.compilers archives again.