help-bison
[Top][All Lists]
Advanced

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

Top Dowm Variable Communication


From: Arijit Das
Subject: Top Dowm Variable Communication
Date: Wed, 22 Aug 2007 13:56:00 +0530

Even though Bison is a bottom up parser, if I need to pass a variable's
content top-down, what are the possible ways (except using global
variable)?


Register_decl
        : REGISTER IDENTIFIER Register_decl_contd
                {
                        Char * register_name = $2;
                        // $2 has the 'register_name' now. I wanted that
name to be communicated down to the scope of the non-terminal
'Register_decl_contd'
                }
        ;


Register_decl_contd
        : '.' IDENTIFIER ...something...
                { ... }
        | '=' IDENTIFIER ...something...
                { ... }
        | '[' IDENTIFIER ...something...
                {
                        // I want to use get the content of
'register_name' here to be able to print user friendly error messages,
if required. 
                        // How can I get that info since register_name
is defined in a top level scope in the non-terminal hierarchy? Any help?
                }

        ;


Thanks
Arijit




reply via email to

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