|LEX/YACC - grammar problems and printing error messages email@example.com (1992-05-28)|
|Re: LEX/YACC - grammar problems and printing error messages firstname.lastname@example.org (1992-05-28)|
|Re: LEX/YACC - grammar problems and printing error messages email@example.com (1992-05-29)|
|LEX/YACC - grammar problems and printing error messages firstname.lastname@example.org (1992-06-02)|
|From:||email@example.com (Criag Wylie)|
|Keywords:||yacc, lex, errors|
|Organization:||Department of Computing at Lancaster University, UK.|
|Date:||Fri, 29 May 1992 11:08:17 GMT|
The easiest way I have found of associating erors with lines, which allows
for multiple errors on lines as well.
As soon as YACC detects an error it calls yyerror(). Change this to
create a linked list/array of error code/text and character position.
When an end of line is detected check to see if the error list is empty,
if it isn't print the line and then print each of the errors. The
character position allows you to position a marker on the line.
The down side of this is error cascading where one error causes a large
number of spurious errors to be seen as the grammar re-synchs with the
[This certainly works, though the original question was how to get a copy
of the entire input line from lex. -John]
Return to the
Search the comp.compilers archives again.