Error messages and Yacc

nielses@imada.dk (Soee Niels)
27 Jul 89 09:08:30 GMT

          From comp.compilers

Related articles
Error messages and Yacc nielses@imada.dk (1989-07-27)
Re: Error messages and Yacc peter@aries5.waterloo.edu (1989-08-02)
| List of all articles for this month |
From: nielses@imada.dk (Soee Niels)
Newsgroups: comp.compilers
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 niels@ifad.dk, 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]
--


Post a followup to this message

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