help-bison
[Top][All Lists]
Advanced

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

concatenating string into $$


From: Tom Jackson
Subject: concatenating string into $$
Date: 26 Feb 2004 14:50:30 -0800

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






reply via email to

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