help-bison
[Top][All Lists]
Advanced

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

Re: Need help to translate pseudo language in C


From: Fabien Oimdu
Subject: Re: Need help to translate pseudo language in C
Date: Fri, 14 Jan 2005 19:56:43 +0000

> Yeah I tried and I have really strange output
> (duplicated strings)
>
> Humm I forgot to say an important thing : V and E
> are NOT terminal symbols.
>

You need to be sure you are using strdup if you are
using char* as a data type.  You can't just do

x = yytext

you need to do something like

x = strdup(yytext)

instead.  Otherwise, you are just setting your pointer
to the buffer location, not a copy of the buffer
contents.

Of course, you need to free this memory eventually
too, if you are worried about that sort of thing.

Also, if V and E are nonterminals, you'll need to be
sure that you are populating $0 appropriately in the
rules for these nonterminals.

Kelly

What is $0 ? I know $$ and $1, $2 but not $0

Could you give an example please ?

Fabien

_________________________________________________________________
MSN Messenger : dialoguez en temps réel avec vos amis ! http://g.msn.fr/FR1001/866





reply via email to

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