Re: Yacc poll

decvax!utzoo!henry
Mon, 17 Aug 87 03:17:07 edt

          From comp.compilers

Related articles
Re: Yacc poll decvax!utzoo!henry (1987-08-06)
Re: Yacc poll pase@ogcvax.UUCP (1987-08-04)
Re: Yacc poll steve@hubcap.clemson.edu (1987-08-11)
Re: Yacc poll ihnp4!m10ux!mncm000) (1987-08-14)
Re: Yacc poll malcolm@keilir.UUCP (1987-08-14)
Re: Yacc poll jbn@glacier.STANFORD.EDU (1987-08-16)
Re: Yacc poll decvax!utzoo!henry (1987-08-17)
Re: Yacc poll harvard!seismo!sun!tekchips!stevev (Steve Vegdahl) (1987-08-17)
Re: Yacc Poll harvard!rutgers!mcnc!ece-csc!mauney (1987-08-18)
| List of all articles for this month |

From: decvax!utzoo!henry
Date: Mon, 17 Aug 87 03:17:07 edt
References: <642@ima.ISC.COM> <378@hubcap.UUCP>, <654@ima.ISC.COM>

> ... It occurs to me that it shouldn't
> be all that hard to change the yacc parser so that it implements the kind of
> error recovery that people have been suggesting for RD, to fake up a stream
> of tokens that lets the parse continue. Has anyone done that, or are there
> pitfalls I hadn't noticed? -John]


This might be practical, although you would probably have to extend yacc
a bit to make it work well: it is essential that error repair prefer
terminating over extending potentially-infinite syntax like parameter
lists. My gut feeling is that the bottom-up nature of LALR parsing gives
you rather less information about what's going on, perhaps enough to make
the idea impractical. My LALR is rusty enough that I'm not sure of this,
though. Certainly it's harder to do than the top-down version.


[That had occurred to me, but I suspect that heuristics like preferring a
token that reduces to one that shifts would help. Besides, you have the
same problem in the top down case: Assume the input string is
"foo = bar + ;" and after it's parsed the +, the lexer were unwise enough
to pass back an open paren as its invented token, because, say, that was
the first thing in the legal list. Due to an nroff snafu, I haven't
finished reading the paper in the previous article -- they may have
addressed this. -John]
--


Post a followup to this message

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