amber@dartvax.UUCP (11/07/83)
I realize that trying to get YACC to handle errors gracefully is difficult, but that sort of thing makes the world go around. So.... Is there any way to get at the token that YACC dies on, resulting in the error recovery? The 'error' operator in YACC will scan off tokens until it recovers and I'd like to get at the first token it scanned off to see why it died. Any suggestions would be appreciated. -David Kovar ...decvax!dartvax!amber
jay@rochester.UUCP (Jay Weber) (11/08/83)
When an error is detected, the yacc variable "yychar" will be set to the lookahead token number. For character tokens like ';', the token number will be the integer value corresponding to it, but if it is a declared token then you will have to come up with a cross-reference table if you want what the token is in english. Jay Weber {..!seismo!rochester!jay, jay@rochester.arpa}
davidk@dartvax.UUCP (David C. Kovar) (04/27/84)
Is there any way in YACC to push a token back onto the input stream? Here's my problem: In Dartmouth Basic, arrays and function calls look alike. They are all <identifier> ( <expression ). I'd like to scan of the identifier, look it up in the symbol table and then decide what action to take. If I am looking for an array identifier and I find a function identifier I want to push it back and let it get caught later. For various reasons I can't determine which it is in the lexical scanner and then return the appropriate token there. Any suggestions at all would be appreciated. -- David C. Kovar USNET: {linus|decvax|cornell}!dartvax!davidk ARPA: davidk%dartmouth@csnet-relay CSNET: davidk@dartmouth U.S. Snail HB 3140 Dartmouth College Hanover NH 03755 "The difficult we did yesterday, the impossible we are doing now."