help-bison
[Top][All Lists]
Advanced

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

Problem with nonterminal values between rules


From: Nouri Al Nahawi
Subject: Problem with nonterminal values between rules
Date: Thu, 8 Oct 2015 10:16:33 +0000 (UTC)

Hi everyone
I wrote a simple C-like grammar in Bison, and I have a weird problem.In the 
following rule:   declaration:     "identifier" length init_values              
        
                    {symbolTable.add($3,$4,$5);}I want to get the int values of 
lenght and init_values, which are nonterminals, to store them in the symbol 
table. "identifier" is a token, and its literal value is stored correctly. 
However, I'm getting some int values like 66236273 for the other symbols.The 
nonterminal rules are:length:             "number" {};                         
init_values:        "number" {};I tried using tokens directly instead of 
nonterminals, but the parser couldn't differentiate btw "number" and "lenght" 
and so on. It just parsed all ints as "number", which made it crash.Does anyone 
know, how to get the actual values of these? i.e. the number values, which I 
was able to find in the last rules, but somehow they get lost when the parser 
goes a step back to the first rule.
Thank you very much in AdvanceNouri

reply via email to

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