Related articles |
---|
Error reporting in LR parsers worley@compass.com (1989-08-02) |
Re: Error reporting in LR parsers djones@megatest.uucp (1989-08-04) |
Re: Error reporting in LR parsers lai@mips.com (1989-08-07) |
Re: Error reporting in LR parsers heirich@cs.ucsd.edu (1989-08-08) |
Re: Error reporting in LR parsers heirich@cs.ucsd.edu (1989-08-08) |
Re: Error reporting in LR parsers rusty@garnet.Berkeley.EDU (1989-08-10) |
Re: Error reporting in LR parsers djones@megatest.com (1989-08-10) |
Re: Error reporting in LR parsers djones@megatest.com (1989-08-10) |
Re: Error reporting in LR parsers djones@megatest.com (1989-08-10) |
[2 later articles] |
From: | lai@mips.com (David Lai) |
Date: | Mon, 7 Aug 89 12:11:44 PDT |
Organization: | MIPS Computer Systems, Inc. |
In <1989Aug6.024931.10014@esegue.uucp>, Dave Jones gives a rebuttal stating
how a default reduction in yacc has eliminated acceptable tokens from the
token list when an error occurs. The problem can be solved by generating
the list of acceptable tokens *before* returning the error token. This
method requires that you test the tokens before returning them to yacc (in
the scanner).
In the case given 'i = j k', the scanner upon reading 'k' checks the parser
state to see whether an identifier is acceptable in this state. This will
be the state prior to the default reduction, where + and * are still
acceptable. The list of acceptable tokens is remembered and the erroneous
token is returned. The 'yyerror' function then prints out the (perhaps
decoded) list of acceptable tokens.
--
David Lai (lai@mips.com || {ames,prls,pyramid,decwrl}!mips!lai)
Return to the
comp.compilers page.
Search the
comp.compilers archives again.