[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: concatenating string into $$
From: |
Valter G. Nogueira Jr. |
Subject: |
Re: concatenating string into $$ |
Date: |
Fri, 27 Feb 2004 08:37:32 -0300 |
Tom,
I believe you should not try concatenating "statements".
A better aproach is build a statement tree and then translate it to the
target language.
At least it is what I have seen people doing.
A good source for reference is gcc java's parser.h.
Valter
----- Original Message -----
From: "Tom Jackson" <address@hidden>
To: <address@hidden>
Sent: Thursday, February 26, 2004 7:50 PM
Subject: concatenating string into $$
> I have a bison rule containing the following:
> ifcmd:
> IFCMD ARGUMENT ENDCMD
> {
> printf("\nif %s {\n ", $2)
> }
> ;
>
> The problem is that A rule like this cannot validate an entire if
> statement. I'm thinking I need a rule like:
>
> ifcmd:
> IFCMD ARGUMENT ENDCMD statements ENDIF
> ...
>
>
> I'm new to using bison, and all the examples are for calculators, where
> it is easy to accumulate results.
>
> What I want to do is to somehow accumulate the "\nif %s {\n" into $$.
>
> Do I need to write a function to perform this operation, or is there
> something simple to help me out??
>
> Are there more complete examples somewhere (I've read _lex & yacc_,
> etc.).
>
> TIA
>
> tom jackson
>
>
>
>
> _______________________________________________
> address@hidden http://mail.gnu.org/mailman/listinfo/help-bison
>
Re: concatenating string into $$, Hans Aberg, 2004/02/28