|Q : YACC - LA firstname.lastname@example.org (1995-10-23)|
|From:||email@example.com (Jan Rene Vestergaard)|
|Keywords:||yacc, question, errors|
|Organization:||DAIMI, Computer Science Dept. at Aarhus University|
|Date:||Mon, 23 Oct 1995 08:45:03 GMT|
I have a question regarding look-ahead symbols in Yacc. Given a
parse-error it would be nice to give constructive feedback to the
programmer, e.g. where it went wrong. This is easy in Yacc. If you
however wants to let the programmer know what symbols the parser
expected to see instead of the erronous no solution offers itself
directly. What I have done is that I in the Yacc-generated file inserts
a [Spy = "Current-state"] assignment, such that when the parser goes
wrong Spy denotes what state the parser went wrong in and then based on
y.output you can output the look-ahead set of that state.
Surely this can be done simpler, right ?
Return to the
Search the comp.compilers archives again.