tags:

views:

35

answers:

1

I have this in my yacc file.

var_declaration : type_specifier ID ';' {$2->args = ""; $2->value = 0; $2->arraysize = 0; $2->type = "variable";}

Everything above works.

I want to add this to it.

fn($2);

From inside the function, I want to do stuff like this.

 fn(struct symtab sp)
    {
    sp->value = 0;
    }

But when I try to compile the program I get this error:

error: invalid type argument of ‘->’ (have ‘struct symtab')

+6  A: 

I guess your function should be

fn(struct symtab* sp)

instead of

fn(struct symtab sp)

and by the way, as $2 is a union I don't think that

$2->args = ""; $2->value = 0; $2->arraysize = 0;

is correct. And

$2->type = "variable";

is not valid.

Pierre