[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: problems with bison-flex
From: |
Laurence Finston |
Subject: |
Re: problems with bison-flex |
Date: |
Sat, 11 Oct 2008 17:47:02 +0200 (CEST) |
On Fri, 10 Oct 2008, Jim Michaels wrote:
> flex is hitting end of file and yyparse always returns 1, error in input.
> The last strings in the file is always
> 0
> EOF
>
> which is the tokens ZERO T_EOF. they are expected in the parser.
> I even tried returning 0 in yylex when it saw "EOF". no difference.
> what do I do?
I think this question came up recently, so perhaps have a look at the
recent threads in the archive. One thing you could try is to have
`yylex' return an `END' token (or the equivalent) to `yyparse' when it
sees `EOF'. I seem to remember having a similar problem with my most
recent parser, but I'm not entirely sure. If I did, I fixed it quickly
this way.
>
> that covers non-C++ parsing problems I have questions with. I suppose I'll
> have the same problems with C++.
>
> do I always need to write a driver for a C++ parser/lexer combo?
For what it's worth, I have always used C++ in combination with Bison but
I've never used the C++ parser feature. I don't really see the point of
it, though I'm sure the developers put it there for a reason. It works
just fine to generate a C parser with C++ code in the actions and compile
with a C++ compiler.
Laurence Finston