This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

"parse stack overflow" on C51

I get this message when compiling my program. It's about 25KB big, and MC have 32KB...
What should I do to compile bigger programs anway, because program is not completed yet, I have to add some more stuff.

Parents
  • It seems that compiler have some bugs

    No, it doesn't, because ...

    The problem was to many if > else if > ... > else if parsing in one block...

    ... that is nesting, too. Under certain circumstances, C blocks don't need to be enclosed in parentheses - and this is one of them. Every else if introduces an additional level of nesting, because the else refers to the preceding if, not to the first if.

    With indentation, this becomes a little clearer:

    if(...)
       ...
    else
      if(...)
          ...
       else
          if(...)
             ...
          else
             if(...)
                ...
             else
                if(...)
                   ...
    

    This happens because C does not have an "elseif" that would place all additional cases at the same level of nesting as the first if.

Reply
  • It seems that compiler have some bugs

    No, it doesn't, because ...

    The problem was to many if > else if > ... > else if parsing in one block...

    ... that is nesting, too. Under certain circumstances, C blocks don't need to be enclosed in parentheses - and this is one of them. Every else if introduces an additional level of nesting, because the else refers to the preceding if, not to the first if.

    With indentation, this becomes a little clearer:

    if(...)
       ...
    else
      if(...)
          ...
       else
          if(...)
             ...
          else
             if(...)
                ...
             else
                if(...)
                   ...
    

    This happens because C does not have an "elseif" that would place all additional cases at the same level of nesting as the first if.

Children