help-bison
[Top][All Lists]
Advanced

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

Return from recursive processing is incomplete


From: Evan Carew
Subject: Return from recursive processing is incomplete
Date: Sat, 05 Sep 2009 20:05:22 -0400
User-agent: Mozilla Thunderbird 1.0.8-1.1.fc4 (X11/20060501)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I'm working with Bison 2.0 on linux and am having trouble getting all
of the output from a recursive call to a rule. I have input a piece of
C code which represents an enum into a lexer designed for C and a
bison rule set designed for C as well. I was hoping to use the
generated parser to do some automated ode rewrites, but an having
trouble figuring out how to access the output.

If I take the default action {$$ = $1} for all rules, I get my input
echoed back out. If I try to edit the default actions, I get strange
behavior. Specifically, when I am trying to programitally access the
enumerator list elements in the enum rules, no matter how many
enumerators I have between the braces, I only get the first one back.
For the following code, where it says "Look Here!", I've tried
everything to get out all the enumerations. My input was [enum blah {
one, two, three }; ] what I get back is [enum blah {one };]. Has
anyone run into this before? BTW, I happen to have John Levine's Flex
and Bison by my elbow as I type this.

enum_specifier
  : ENUM '{' enumerator_list '}' { /*emit("enum { %s }", $3); */}
    | ENUM IDENTIFIER '{' enumerator_list '}' {/* Look Here!*/}
    | ENUM IDENTIFIER { /*emit("enum %s", $2); */}
    ;

enumerator_list
  : enumerator
    | enumerator_list ',' enumerator
    ;

enumerator
  : IDENTIFIER
    | IDENTIFIER '=' constant_expression
    ;


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFKovzCpxCQXwV2bJARAppuAJsFh92P68CLRqIX0BdV05mLW1J2KACgo6lv
QszHPAVysN3iAYaRadgyNfE=
=iDog
-----END PGP SIGNATURE-----





reply via email to

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