-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hey
I'm guessing were not going to debug it for you but say, GDB? But some tips are, I take it your using LEX with this? If so say you have a rule like identifier something like [a-zA-Z]+ thats bad rule.. but anyways, make sure you do a string dump of that or your not going to be able to reference it again, that might be your >5 char problem. by the way, a better identifier rule would be ID [a-zA-Z][a-zA_Z0-9_]* I think your need to look at how its all going to work a little more, are you using a %union? That would help as well for your rule returns of different types or you have to make your lex return only what YYSTYPE is and your rule returns will be that also. Try to think of how you want to structure the execution or things before writing the grammar helps me, because the parser is the link between how you interpret the rules. quick tip: don't do this your going to have a headache :P malloc( sizeof(struct ext_cmd) ); if ( $$ == NULL) printf("Memory Allocation Error\n"); something like: void* xmalloc ( size_t size ) { register void* mm= malloc( size ); if ( !mm ) fatal("Heap size limit reached!\n"); return mm; } Kyle Brandt wrote: > I'm not quite sure how memory allocation is working with Bison, but with the > following Grammar, my code segfaults when my execute_command function is > called from the redirect rule with an argument more than 5 char in length, > but it works fine when called from command rule. Your not going to be able to fault memory corruption or problems on bison or lex, they are rock solid make sure you know what your doing with their outcomes though. anyways that my $0.02 - --Phil -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkqzs6YACgkQAhcOgIaQQ2GIhACdHsDtVP4TlCOmm5e3AM8FDXiD Z24An2MIUGuaF7MLlEiy1PfJYA/s5hPn =F9Da -----END PGP SIGNATURE----- _______________________________________________ help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison