|Error reporting with YACC (or Bison) email@example.com (2000-09-21)|
|Re: Error reporting with YACC (or Bison) firstname.lastname@example.org (Timur Safin) (2000-09-23)|
|Re: Error reporting with YACC (or Bison) Joachim.Pimiskern@de.bosch.com (Joachim Pimiskern) (2000-09-28)|
|Date:||21 Sep 2000 18:13:36 -0400|
|Organization:||Deja.com - Before you buy.|
|Keywords:||yacc, errors, comment|
(This is pretty heady newsgroup, so I'm almost embarrassed to post this
question here. If there is a more appropriate group for this type of
question, please let me know. OK, onto the question...)
I used Flex and Bison to write an interpreter for a simple c-like
language. When Bison encounters a syntax error it spits out "parse
error". I want to give more descriptive error messages, such
as "expecting semicolon after line 3". How would I go about this?
The best I can think of so far is to create productions in my grammar
for every bogus syntax I can think of, and generate errors when they
Is there a better way using these tools?
[Not really. Yacc doesn't give you much help at error recovery. People
have tried to do better error reports over the years, see the comp.compilers
Return to the
Search the comp.compilers archives again.