Reporting errors from yacc/bison grammar...

"Derekasaurus Rex" <>
26 Jan 2001 17:03:23 -0500

          From comp.compilers

Related articles
Reporting errors from yacc/bison grammar... (Derekasaurus Rex) (2001-01-26)
| List of all articles for this month |

From: "Derekasaurus Rex" <>
Newsgroups: comp.compilers
Date: 26 Jan 2001 17:03:23 -0500
Organization: Compilers Central
Keywords: yacc, errors, question
Posted-Date: 26 Jan 2001 17:03:23 EST


I'm quite new to yacc/bison, but from what I've seen so far it leaves
much to be desired in its handling of errors. What is a good way to
produce meaningful errors?

I wrote a grammar for a file format I need to parse, but now I would
like to say, "hey, I expected this..." instead of a generic parser
error message. Is there a way to do this w/o enumerating errors as
grammar rules?

There have been a number of short threads about this, but I have not
found any good answers.


[If you look way back in the compilers archives, you'll see some work
on extracting follow sets from yacc parsers for error messages.
Personally, I don't find such messages very useful since for far too
many kinds of errors, the follow set is totally misleading. -John]

Post a followup to this message

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