Menu

#2 Make use of static fields optional

open
code (5)
5
2006-11-18
2006-11-09
Mike Snare
No

Most of the fields that exist in the generated parsers
are static (yyname, yyrule, etc). In an app with many
parsers -- each of which is large with many tokens and
rules -- this can be a significant memory concern.
There should be an option to use non-statics whereever
possible.

This should NOT affect the public statics like the
shorts used for the tokens (since lexers need easy
access), but for most others.

Most importantly, I'm talking about yyname and yyrule,
but I can't (for the moment) see why YYSTACKSIZE,
yylhs, yylen, yydefred, yydgoto, yysindex, yyrindex,
yygindex, YYTABLESIZE, yytable, yycheck, YYFINAL, or
YYMAXTOKEN should be statics.

P.S. -- I'm glad to see someone is making improvements
to the code -- I like the -Jnodebug in particular.

Thanks,
-Mike

Discussion

  • Tomas Hurka

    Tomas Hurka - 2006-11-18

    Logged In: YES
    user_id=482413
    Originator: NO

    You are right that there is no need to have so much static fields. I think that the use of static fields are the direct consequence of porting byacc to byacc/j.

     
  • Tomas Hurka

    Tomas Hurka - 2006-11-18
    • labels: --> code
    • assigned_to: nobody --> thurka
     
  • Mike Snare

    Mike Snare - 2006-11-29

    Logged In: YES
    user_id=1065000
    Originator: YES

    Glad to hear you agree. Any idea when a fix might be available? I'm really trying to tweak memory savings out of my app (we're dealing with many large parsers) and I'm toying with the (way less than ideal) step of tweaking the generated parsers post-byacc to remove the static modifiers. Any help would be appreciated.

    -Mike

     

Log in to post a comment.