You might want to post a question about cleaning up the strings, to see if you get a reply from some of those using C. Bison has a feature %destructor, that can be used to clean up the stuff in the case of errors. In other case, it must be cleaned up in the actions, I think.
That's a good point. I used strdup() in the flex file: {WORD} { yylval.str = strdup( yytext ); return WORD; }
But I get a memory leak even when I free the the in the bison file like this: WORD EQUAL WORD { $$ = !strncmp( $1, $3, 128 ); free( yylval.str ); } I do not get an error message when compiling but valgrind shows me a leak in the strdup() function: > valgrind --leak-check=full rules ... ... ==935== 3 bytes in 1 blocks are definitely lost in loss record 2 of 3 ==935== at 0x401B46D: malloc (vg_replace_malloc.c:149) ==935== by 0x40D1B9F: strdup (in /lib/tls/libc-2.3.6.so) ==935== by 0x8048976: yylex (in /RulezParser/flex_bison_test/rules) ==935== by 0x804990E: yyparse (in /RulezParser/flex_bison_test/rules) ==935== by 0x804A498: main (in /RulezParser/flex_bison_test/rules) ... Guess I search the archives and consult the manual before I post a question about this issue - except somebody here on this list can give me a hint ;-) thanks, arno _______________________________________________ Help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison