Error detection under Yacc

patrick cohen <>
12 Aug 1999 02:55:52 -0400

          From comp.compilers

Related articles
Error detection under Yacc (patrick cohen) (1999-08-12)
Re: Error detection under Yacc (1999-08-13)
Re: Error detection under Yacc (Srik) (1999-08-21)
| List of all articles for this month |

From: patrick cohen <>
Newsgroups: comp.compilers
Date: 12 Aug 1999 02:55:52 -0400
Organization: Compilers Central
Keywords: yacc, errors, comment

Hello every body,

          What is the best way to detect an error under Yacc? For example I
want to be able to say to the programmer that the parser is expecting
the "THEN" token in a IF ... THEN ... ELSE ... statement. Perhaps I
should try to push all the token in the parsing stack and see if the
error is recovered or not. I'm not sure is the best way. Do you have
any idea about that?

[This question has come up several times in the past. It is possible
to tell in each parser state what tokens are valid, but that doesn't
seem to tell programmers anything they didn't already know. -John]

Post a followup to this message

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