[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: |
Tue, 14 Oct 2008 17:13:33 +0200 (CEST) |
On Mon, 13 Oct 2008, Jim Michaels wrote:
> as I basically said before, My stack and dequeue template class is
> written in C++.
I didn't understand this. I thought you might have meant that
you needed some features from the C++ parser class.
> I could possibly rewrite it in C (why?), but my
> compiler doesn't like calling C++ code from within C files.
>From the point of view of a C++ compiler, there's no such thing as
a C file. With a few exceptions, a C++ compiler should compile
correct ANSI-C code without any problems. You might need to specify
C-linkage for some function or other to prevent name-mangling. I
don't think I had to do this for `yyparse' when I was using the MS
Visual C++ compiler, but it shouldn't be a problem if it is necessary.
> perhaps
> an extern "C++" {} is necessary. I don't know what will make it
> work. even then it's extern. I am trying to include the header
> which has the class definition so I can use it.
I don't know what you mean by this.
One thing that occurred to me is that you might be having problems if
you're putting your date-time specification together in the scanner.
It might work better if you just let the scanner return the elements
as tokens, e.g., `UNSIGNED_INT', `COLON', `HYPHEN', etc., and assemble the
date-time specification in the parser. That's what I do in the
scanner-parser pair for the program I'm working on now and it works fine.
Scanning character-by-character, as discussed before, should solve the
problem if your scanner is somehow missing an `EOF' and then blocking.
I can't think of any reason why it would be a problem.
Laurence Finston