On Monday, November 05, 2012 09:11:58 AM Michael Muller wrote:
> Michael Quick wrote:
> > It's 8AM and I haven't used C or with stacks in a long time; how does
> > 'stack_anchor' become NULL? What is advancing the stack_anchor to the next
> > value? I guess I'm wondering if you have some unintentional (obviously)
> > conditions which would keep the loop from progressing.
>
> Yes. It looks like the body of your inner while statement is never
> executing. You appear to be spinning in your outer while loop.
>
Thanks Michael Q. and Michael M. for your replies. I'm new to gdb and I was
misinterpreting what it was telling me. It was only with your help that I
could realize that my code was not correctly implementing the pseudocode I was
working from.
Instead of two "while statements", this is what was needed:
while ((stack_anchor != NULL) && ((op_precedences[stack_anchor->value.op_code]
> op_precedences[ptoken->value.op_code]) || ((op_precedences[stack_anchor-
>value.op_code] == op_precedences[ptoken->value.op_code]) &&
(op_associativity[op_precedences[stack_anchor->value.op_code]] == LEFT)))) {
The program now works correctly for the test cases I've given it.
_______________________________________________
Mid-Hudson Valley Linux Users Group http://mhvlug.org
http://mhvlug.org/cgi-bin/mailman/listinfo/mhvlug
Upcoming Meetings (6pm - 8pm) Vassar College
Nov 7 - Typography: Physical Art to Digital Art
Dec 5 - Sysadmin Panel