|Error messages and Yacc email@example.com (1989-07-27)|
|Re: Error messages and Yacc firstname.lastname@example.org (1989-08-02)|
|From:||email@example.com (Soee Niels)|
|Date:||27 Jul 89 09:08:30 GMT|
|Organization:||Dept. of Mathematics and Computer Science, Odense University, Denmark|
We are using yacc to write a compiler, and we have problems
as we want to give some meaningful error messages to the user.
Yacc knows which symbol is valid from every state, and we want to
use this information to write something like:
LEFTPAR or SEMICOLON expected.
One possible solution to the problem is a function "yyexpected"
that could return a list of possible terminal symbols.
Does any of you have this function, or is there another
solution to the problem?
Thank you in advance.
My email address is firstname.lastname@example.org, but maybe the answer is of
interest to the newsgroup.
[This is not as easy as it looks, because yacc combines states
wherever possible, which means that the legitimate follow set in each
state is often a lot larger than the grammar would make it. There
has been a lot of work done on improving yacc's notoriously weak
error handling, and nobody has asked about this for a while, so I'd
be interested in hearing what's new in yacc error recovery. -John]
Return to the
Search the comp.compilers archives again.