jonathan-beard/simple_wc_example — pull request #3 by wamckee (2013-04-03 23:40:20+00:00)
Title: Memory leaks in mc_parser.yy

I created a fork (inadvertently) with a new grammar / code defined in mc_parser.yy. It fixes a few problems with memory leaks and heap management. If you like the changes, please merge the code.

1) Since we are allocating the token strings on the heap,
we need to tell Bison how to clean up the heap in the event
of an error. We use the %destructor directive for this purpose.

2) We need to manage the heap to prevent memory leaks when
the parser succeeds. Therefore, I have rewritten the grammar and
I propose we use an intermediate "object" rule to do
the memory management. This requires the addition of the %type
directive so the pointers get passed to the object rule correctly.

P.S. I'm new to github so please bear with me. I'm using their web interface right now. I'm not sure about how to merge branches and forks so I'll leave that up to you. Thanks.