Re: Error with grammar arguments
Chris verBurg <[email protected]>
| Newsgroups | gmane.comp.parsers.bison.general |
|---|---|
| Message-ID | <CAMK0+vtpYJ+8d44N0ySTcaqd9Ws2kjkhrOE+DzL2E452+0QjFA@mail.gmail.com> |
Rob, To ask a sanity question, you do strdup (or otherwise allocate fresh memory for) yytext on the Flex side when returning tokens, yes? -Chris On Tue, Dec 18, 2018 at 9:15 AM Rob Casey <[email protected]> wrote: > Hello, > > I have a (large) grammar where I have code similar to that below: > > | identifier ':' array_spec_init { > log_debug( "%p", $identifier ); > log_debug( "%p", $array_spec_init ); > } > > When this grammar is run, the following is shown in the output: > > Stack now 0 1 3 15 83 > Entering state 194 > Reducing stack by rule 154 (line 2062): > $1 = token identifier (1.6-25: ) > $2 = token ':' (1.27: ) > $3 = nterm array_spec_init (1.29-56: ) > debug: *0x255b930* > debug: *0x255b930* > > Note that the same pointer address is returned for $identifier and > $array_spec_init. > > Before asking anyone to look at my grammar, I thought I would ask as to > whether anyone has seen an error such as this before? > > Thanks in advance. > > Rob > _______________________________________________ > [email protected] https://lists.gnu.org/mailman/listinfo/help-bison > _______________________________________________ [email protected] https://lists.gnu.org/mailman/listinfo/help-bison