Related articles |
---|
Error reporting with YACC (or Bison) etetz@my-deja.com (2000-09-21) |
Re: Error reporting with YACC (or Bison) timur@lantel.ru (Timur Safin) (2000-09-23) |
Re: Error reporting with YACC (or Bison) Joachim.Pimiskern@de.bosch.com (Joachim Pimiskern) (2000-09-28) |
From: | "Timur Safin" <timur@lantel.ru> |
Newsgroups: | comp.compilers |
Date: | 23 Sep 2000 14:47:13 -0400 |
Organization: | Compilers Central |
References: | 00-09-157 |
Keywords: | yacc, errors |
Hi Eric,
You could try to insert into your grammar "error-productions", most
frequently used errors for some obvious cases. For example :
pascal_for : FOR term ASSIGN integer_expression TO integer_expression DO
statement
| FOR term ASSIGN integer_expression TO
integer_expression { yyerror("DO expected"); ... }
statement
| ...
;
But be care, inserting extra-actions in some places of your grammar could
produce more ambiguity of your grammar. But anyway (with more headache) you
could try some workarounds...
Best Regards,
Timur Safin
mailto:timur@lantel.ru http://timur.lanit.ru
mailto:timur@intersystems.ru
> 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?
Return to the
comp.compilers page.
Search the
comp.compilers archives again.