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

Re: information on sablecc (error recovery)



On Mon, Nov 17, 2003 at 04:26:21PM -0500, Etienne Gagnon wrote:
> Hi Pieter,
> 
> I you are willing to work on this, I would suggest that you take the 
> approach
> suggested in Andrew Appel's "Modern compiler implementation in Java" book,
> *second* edition, namely:  Page 78 & 79 "GLOBAL ERROR REPAIR" (using the 
> Burke-Fisher
> error repair algorithm), which would fit quite nicely in the SableCC 
> framework.
> 
> To change this (e.g. Burke-Fisher), you need not modify any *.java source 
> files,
> only the source *.txt files in src/org/sablecc/sablecc/.
> 
> Hava fun!
> 
> Etienne

Oddly enough, I have been doing exactly this over the past couple of weeks.
Same textbook and everything. It does require some modification of the
"GenParser.java" and "GenUtils.java" files as well as the corresponding
macro files.

The approach I've taken permits repairs like the ML-yacc "%change" directive
described on page 82-83 of Appel's book (I think I have the 2nd edition), as
well as the usual Burke-Fisher insertion, substitution and deletion of
single tokens.

I've been using SableCC version 3.0 beta 2 as the basis for this work, and
included the filter() method if the --no-inline option is used when
generating the parser.

I've only tested it as far as parsing correct source files, but have yet to
test and debug the actual error repair mechanism. I'll be kicking it into a
proper shape over the next few days if anyone is interested.

> pieter@West.NL wrote:
> >Hello Mr. Gagnon,
> >
> >I'm planning on using your compiler compiler, but I want to adapt it al
> >little. I noticed that a compiler, generared with the latest version (3.0
> >beta 1) of your compiler compiler, stops as soon as an error is
> >encountered in the in the input file. I want to adapt this in order to
> >make the compiler continue so that other errors will be found too (for
> >example by letting the compiler guess which token was omitted). However,
> >in stead of goning through every single source file to find out how I can
> >do this, I hoped you could tell me in which file(s) your compiler compiler
> >handles the possible errors in the input file.
> >If I know this, adapting the compiler compiler to my needs will at least
> >be a little easier.
> >Thanks in advance.
> >
> >Greetings,
> >Pieter van der Spek
> >
> >
> >PS If you like, I can send you my modifications
> >
> >
> >
> >-------------------
> >
> >Pieter van der Spek
> >---- West Consulting B.V.        - www.west.nl
> >---- Tu Delft / Computer Science - www.tudelft.nl
> >
> >
> 
> 
> -- 
> Etienne M. Gagnon, Ph.D.             http://www.info.uqam.ca/~egagnon/
> SableVM:                                       http://www.sablevm.org/
> SableCC:                                       http://www.sablecc.org/
> 

-- 
Jon Shapcott <eden@xibalba.demon.co.uk>
"This is the Space Age, and we are Here To Go" - Wlliam S. Burroughs



-- 
Etienne M. Gagnon, Ph.D.                             egagnon@j-meg.com
President                                      http://www.sablevm.org/
J-Meg inc.                                     http://www.sablecc.org/