Q: Error detection/recovery in LEX/YACC (Help)

friesend@herald.usask.ca (Darryl Friesen)
Fri, 17 Dec 1993 19:05:19 GMT

          From comp.compilers

Related articles
Q: Error detection/recovery in LEX/YACC (Help) friesend@herald.usask.ca (1993-12-17)
Re: Q: Error detection/recovery in LEX/YACC (Help) collison@osf.org (1993-12-20)
Re: Q: Error detection/recovery in LEX/YACC (Help) neitzel@ips.cs.tu-bs.de (1993-12-20)
re: Q: Error detection/recovery in LEX/YACC (Help) bdarr@atr-2s.hac.com (1993-12-21)
Re: Q: Error detection/recovery in LEX/YACC (Help) neitzel@ips.cs.tu-bs.de (1993-12-23)
Re: Q: Error detection/recovery in LEX/YACC (Help) hage@netcom.com (1994-01-18)
Re: Q: Error detection/recovery in LEX/YACC (Help) neitzel@ips.cs.tu-bs.de (1994-01-27)
| List of all articles for this month |
Newsgroups: comp.compilers
From: friesend@herald.usask.ca (Darryl Friesen)
Keywords: lex, yacc, errors, comment
Organization: University of Saskatchewan
Date: Fri, 17 Dec 1993 19:05:19 GMT

[Hi all. I posted a similar message in comp.lang.c a while back (before I
found this group) with little response. I'm hoping that I'll do better
here :) ]


I need a little help with error detection/recovery/repair in either or
both of LEX and YACC (a little snippet of code, even just a few
productions, would be tremendously appreciated! :).


The documentation I have on YACC mentions (very briefly) the use of the
"error" keyword in productions, but doesn't give a good example of how
this can be used to provide good error messages (ie. what line, what
token, what was expected etc) and how the error could be corrected (or at
least recovered from to allow the parse to continue).


I'd appreciate any help I could get.


Thanx for your time,


- Darryl


PS. Is it best to keep all (most) symbol table interactions
(ie. lookup, insertions) in the scanner? I'm a little new
to LEX/YACC in case you haven't noticed :)
--
          Darryl Friesen | Client Services
Darryl.Friesen@usask.ca | Dept of Computing Services
friesend@sask.usask.ca | University of Saskatchewan
[I certainly do the basic symtab lookups in the scanner, though only in
the parser or later can I assign attributes to the symbols. Re error
handling, it's a pain in yacc, not the least because many older yaccs have
bugs in the error rule code. See the Levine (me), et al., lex&yacc and
Schreiner and Friedman, both of which discuss error recovery. The FAQ has
the complete references. -John]
--


Post a followup to this message

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