Related articles |
---|
Problem with Flex/Bison and C/C++ dj.cyberdance@gmx.at (Christoph B.) (2006-03-22) |
Re: Problem with Flex/Bison and C/C++ johnmillaway@yahoo.com (John Millaway) (2006-03-27) |
Re: Problem with Flex/Bison and C/C++ cfc@shell01.TheWorld.com (Chris F Clark) (2006-03-27) |
Re: Problem with Flex/Bison and C/C++ haberg@math.su.se (2006-03-27) |
From: | John Millaway <johnmillaway@yahoo.com> |
Newsgroups: | comp.compilers |
Date: | 27 Mar 2006 01:17:10 -0500 |
Organization: | Compilers Central |
References: | 06-03-077 |
Keywords: | yacc, C++ |
Posted-Date: | 27 Mar 2006 01:17:10 EST |
> Is there a way to define the data format for nonterminals
> outside from YYSTYPE? There is no need for the lexer to know about these
> data types, structures using these types are created by the yacc file,
> lex doesn't need to know anything about these nonterminals...
>
> If there is no other solution, can't I compile the lexer output using
> g++?
Hi Christoph,
You can compile your flex "C" scanner using g++ just fine. The only
compatibility issue we know of will be the memory management (malloc vs.
new), which, in practice, is not a problem. Just keep 'em separate.
AFAIK, there is no way to separate non-terminal types from terminal types in
bison. If you absolutely need your scanner to be compiled as C, you can trick
it, as in:
%union {
Foo* f;
}
And in the scanner,
%{
typedef void* Foo;
#include "y.tab.h"
%}
-Millaway
Return to the
comp.compilers page.
Search the
comp.compilers archives again.