[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
using flex and bison in a c++ program
From: |
Pieter Breed |
Subject: |
using flex and bison in a c++ program |
Date: |
Fri, 12 Oct 2001 01:34:49 +0200 |
hi
I am doing a compiler for a Pascal - like language (Oberon) for my final
year project. I have some trouble using Flex and Bison correctly. Maybe I
should state I am a complete rookie :)
OK. this is what goes: I have files called <lex-file>.Lex, <bison-file>.y &
<mainprogram>.cc . When I run bison on the <bison-file>.y file it goes
through and generates the <b-file>.tab.h & <b-file>.tab.c The .h file I
#include in my <flex-file>.Lex file and the <b-file>.tab.c file is #included
in my <mainprogra>.cc file. So I have a flex yyFlexLexer class that I can
use and a bison yyparse() function which calls yylex() in a roundabout
manner. I am now at the stage where my language parses fine, real fine.
I want to start with the semantic analysis now and subsequently made a
%union bison declaration. I get the following error. (This was the only
change I made) :
In file included from OberonC.cc:38:
Oberon.Parser.y:11: conflicting types for `typedef union YYSTYPE
YYSTYPE'
FlexBison/Oberon.Parser.tab.h:5: previous declaration as `typedef union
YYSTYPE YYSTYPE'
In file included from OberonC.cc:38:
/usr/lib/bison.simple:138: conflicting types for `YYSTYPE yylval'
FlexBison/Oberon.Parser.tab.h:49: previous declaration as `YYSTYPE
yylval'
Taking out the offending %union makes my little proggy happy again.
I would appreciate any ideas on how I could fix this. I have included my
project tar (yes I know - the gawdz of eViL will punish me for attaching a
file to a mailing-list, but it really is quite small ... :) )
Thanx alot
Pieter Breed
address@hidden
PS - please reply to my email address...
Oberon_Compiler_4_P.tar.gz
Description: GNU Zip compressed data
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- using flex and bison in a c++ program,
Pieter Breed <=