Re: Unable to use error recovery with bison (Federico Tomassetti)
26 Apr 2005 20:41:59 -0400

          From comp.compilers

Related articles
Unable to use error recovery with bison (2005-04-11)
Re: Unable to use error recovery with bison (2005-04-16)
Re: Unable to use error recovery with bison (2005-04-26)
| List of all articles for this month |

From: (Federico Tomassetti)
Newsgroups: comp.compilers
Date: 26 Apr 2005 20:41:59 -0400
References: 05-04-024 05-04-052
Keywords: yacc, parse
Posted-Date: 26 Apr 2005 20:41:59 EDT (Hans Aberg) wrote in message news:05-04-052...
> (Federico Tomassetti) wrote:
> > I spent the last days trying to make error recovery working but I
> > can't catch one and yyerror is always invoked:
> >
> > I report a portion from the lex source, yacc source and file parsed.
> >
> > I always obtain the message "syntax error, unexpected NEWLINE,
> > expecting SPACE"
> Looking at your grammar, you have
> voidspace: SPACE | TAB | NEWLINE
> ;
> thus only admitting eaxctly one of the three, for example in your rule
> class_decl_header:
> You probably want any number of these.

No I wanna admit just ONE space, no more and neither a tab of a
newline instead of the space

> It is common to let the lexer zip out the whitespace by .l rules:
> [ \f\r\t\v]+ {}
> \n+ {}

It's not what I want. I wanna create a language with very strict rules
that give me an error if I use two spaces instead of one. My problems
are relative to the error catching: every time I create a rule
containing the error token I get the rule never executed. Can I have
some examples of error catching in your yacc/bison files?

what means \f? and \v?

Post a followup to this message

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