help-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

lea.y:124.34-35: $1 of `program' has no declared type


From: Edulix
Subject: lea.y:124.34-35: $1 of `program' has no declared type
Date: Fri, 11 Mar 2005 13:54:35 +0100
User-agent: KMail/1.7.1

Hi !

I'm developing an interpreter with C, bison and flex. Now I have already done 
the flex file, the bison file, and the header file were the rule/tokens type 
are defined.

###header file:
A lot of thins like:

typedef struct {
        int *foo;
        char *bar;
} Tmy_type;

###flex file:
It has needed includes similar to:

#include "header.h"
#include "y.tab.h"

 and tokens are used like:

{D}+                                    {
                                                        yylval.int_val = 
malloc(sizeof(int));
                                                        *(yylval.int_val) = 
atoi(yytext);
                                                        printf("INT_VAL "); 
return INT_VAL;
}

###bison file:
It has proper includes:

#include "header.h"

Also an %union similar to:

%union {
        int *int_val;
        Tmy_type *Tmy_type;
}

tokens with need of type :

%token <int_val> INT_VAL

And rules types:

%type <T-my_type> myrule
###


I've created a Makefile that compiles as usual:

lea: header.o
        flex lea.l
        bison --verbose -d lea.y
        $(CC) -o lea header.o lex.yy.c y.tab.c -lfl -lm $(CFLAGS)

But I'm having problems with the lea.y file. It just complains for every rule 
like this:
$ bison --verbose -d lea.y
lea.y:124.34-35: $1 of `program' has no declared type
lea.y:124.42-43: $3 of `program' has no declared type
....

Anyone can help me with this please? Any ideas? Any suggestions ?

You can see actual code ifyou want - it's not much large :-). To gt it, just 
execute:

svn checkout svn://svn.berlios.de/lea/trunk

Thanks for your time,
     Edulix.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]