help-bison
[Top][All Lists]
Advanced

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

Re: yacc union problem


From: Kelly Leahy
Subject: Re: yacc union problem
Date: Thu, 10 Feb 2005 12:23:06 -0800 (PST)

I believe this line:

struct estructura_expresion *der;

should be

struct _estructura_expresion *der;

note the _.

Kelly

--- Diego <address@hidden> wrote:

> Hi!!
> 
> 
> 
> I'm training to compile a lex-yacc program, and I
> have a problem with the
> yacc union. 
> 
> 
> 
> I declare to types of structures
> (estructura_conector  and
> estructura_expresion), and I use them in the yacc
> union. The way the code
> now is it works but if I uncomment one of them, this
> error come up:
> 
> 
> 
> In file included from trad.lex:11:                  
>                  -->
> this is #include "y.tab.h"  //at lex archive
> 
> trad.yac:43: parse error before
> `estructura_conector'
> 
> trad.yac:43: warning: no semicolon at end of struct
> or union
> 
> ......
> 
> 
> 
>  This is the code:
> 
> 
> 
>     /* -- Declaraciones de tipos y estructuras -- */
> 
>     /* Estructura para almacenar los conectores
> logicos junto con su tipo.
> */
> 
> typedef struct _estructura_conector
> 
> {
> 
>         char nombre[MAX_CAD]; /* Conector. */
> 
>         char tipo;         /* Tipo del conector
> {l,g,p}. */
> 
> } estructura_conector;
> 
> /* Estructura para almacenar las expresiones. */
> 
> typedef struct _estructura_expresion
> 
> {
> 
>         char izq[MAX_CAD];
> 
>         struct estructura_expresion *der;
> 
>         estructura_conector conector;
> 
>         char tipo;
> 
> } estructura_expresion;
> 
> 
> 
> 
> 
> %}
> 
> 
> 
> /* Tipo de yylval - YYSTYPE */
> 
> %union
> 
> {
> 
>     char nombre[21];
> 
> //    estructura_conector conector;     --> This is
> line 43 and the error
> come up when I uncomment this line /* Para
> conectores y agregador.
> 
> //                                      */
> 
> //    estructura_expresion expresion;   /* Para
> expresiones binarias.
> 
> //                                      */
> 
> }
> 
> 
> 
> 
> 
> 
> 
> I'm using bloodshed Dev-C++ to compile the whole
> proyect, and my bison
> version is 1.875.
> 
> 
> 
> Do you have any idea what the problem could be ?
> 
> 
> 
> Thanks for all.
> 
> 
> 
> Sorry for my english.
> 
> 
> _______________________________________________
> address@hidden
> http://lists.gnu.org/mailman/listinfo/help-bison
> 





reply via email to

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