[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: SableCC Thoughts Part II

Dan Sandberg wrote:
>  I think
> the alternative error node should only apply once processing of
> production a has started. 

OK...  Let's pick a little more elaborate example...

d = a | 'j' 'k';

a = 'j' 'b' | 'c' | error 'eol';

(where x is a production, and 'x' is a token).

input string:  'j' 'e' 'eol'

what should happen?

Now, think about recursive rules, some of them having an "error"
production...  I am far from convinced that there is an "intuitive" and
clear answer as to how a parser generator might decide to handle these
cases.  Yes, parser generators do handle these cases.  But, is what they
do really intuitive? 

I invite you to browser the comp.compiler newsgroup archives.  The
question of error recovery comes up every now and then.  Many compiler
gurus have reported on the advantages and failures of various

Have fun!


Etienne M. Gagnon, M.Sc.                     e-mail: egagnon@j-meg.com
Author of SableCC:                             http://www.sablecc.org/
and SableVM:                                   http://www.sablevm.org/