Akim Demaille <[email protected]> wrote: >>>> /* Pop the current state because it cannot handle the error >>>> token. */ >>>> - if (yystack.height == 1) >>>> + if (yystack.height == 0)
>>> Is this O(1)? We keep the height of the stack up to >>> date ourselves? I'm surprised we don't rely on some >>> Java container to do this for us. >> What do you mean by O(1) in this case? > In C++ that's a typical case where list.size() == 0 is > a bad idea, since it costs a full traversal of the list > to compute its length, while list.empty() is immediate. Ah, okay. > But here it appears that we deal with the length of the > stack by hand, which is OK, but surprised me. Well, you'd have to ask Paolo for the reasoning behind that :-). >> The parser logic >> here is shared with the C++ skeleton (and yacc.c looks >> similar as well). The stack implementation doesn't look >> very frightening performance-wise. > That the stacks needs to be implemented by hand in C is > no surprise :). I meant the Java one. Tim
