Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!henry From: henry@utzoo.UUCP (Henry Spencer) Newsgroups: net.micro.apple Subject: Re: LL(1) parser for an apple. (are you - (nf) Message-ID: <3863@utzoo.UUCP> Date: Wed, 16-May-84 17:42:28 EDT Article-I.D.: utzoo.3863 Posted: Wed May 16 17:42:28 1984 Date-Received: Wed, 16-May-84 17:42:28 EDT References: <3321@fortune.UUCP> Organization: U of Toronto Zoology Lines: 30 Rob Warnock says, in part: It also happens to be the case that IF the grammar is LL(1) or even reasonably close, a recursive-descent parser is: ... 4. Capable of acceptable error-handling (assuming you want to detect errors, not "fix" them) This is actually an understatement. Error-handling is much easier in recursive-descent/LL(1) than in LALR systems like yacc. It is possible to build an error-handling module which fits between the parser and the scanner which does all the work. The parser has to be specific about what it wants -- this just means a slightly unusual-looking "scanner" interface for the parser -- but the parser then sees a syntactically- correct program regardless of what the user feeds in. The key feature of top-down parsing, for this and other purposes, is that the software "knows what it wants": it has a fairly specific idea of what sort of input it's expecting at a given instant, and can take intelligent action if there is a mismatch. Bottom-up methods like yacc don't give you this sort of detailed context to work in, which is why error repair is such a headache for them. The above is not theory; such an error-repair system was built here at U of T years ago for the SP/k compiler, and several similar things for other languages have been done since. It really works well. -- Henry Spencer @ U of Toronto Zoology {allegra,ihnp4,linus,decvax}!utzoo!henry