jrvest@daimi.aau.dk (Jan Rene Vestergaard)
Mon, 23 Oct 1995 08:45:03 GMT

          From comp.compilers

Related articles
Q : YACC - LA jrvest@daimi.aau.dk (1995-10-23)
| List of all articles for this month |

Newsgroups: comp.compilers
From: jrvest@daimi.aau.dk (Jan Rene Vestergaard)
Keywords: yacc, question, errors
Organization: DAIMI, Computer Science Dept. at Aarhus University
Date: Mon, 23 Oct 1995 08:45:03 GMT

Hi !

    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 ?


Post a followup to this message

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