help-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Work around Java's ``code too large'' limitation


From: Di-an JAN
Subject: Work around Java's ``code too large'' limitation
Date: Sat, 8 Nov 2008 10:26:43 -0800 (PST)

From: Paolo Bonzini <address@hidden>
Date: Tue, 28 Oct 2008 18:59:16 +0100
To: address@hidden, address@hidden
Subject: Proposals for various changes to the Java parser

5. Work around Java's ``code too large'' limitation for large parser tables.
http://lists.gnu.org/archive/html/help-bison/2008-10/msg00005.html

I think switching unconditionally to one-initializer-per-table is the
easiest approach by far, and gives 99% of the benefit.

I implemented the version that allows more than about 10000 states,
symbols, rules, and table entries, just to show that it could be done
with only changes to the Java skeleton.  Then it's easy to stripped down
to the simpler version.  I don't really care which version is comitted.

Both tested with only the Java tests from the testsuite on Cygwin.

Di-an Jan




 data/java.m4      |   85 +++++++++++++++++++++++++++++++++
 data/lalr1.java   |  134 ++++++++++++++++++++++++++---------------------------
 doc/bison.texinfo |   21 ++++++++
 tests/java.at     |   18 +++++++
 4 files changed, 190 insertions(+), 68 deletions(-)


2008-11-06  Di-an Jan  <address@hidden>

        Workaround Java's ``code too large'' problem for parser tables
        by providing a choice of implementation strategies.
        * data/java.m4 (b4_parser_tables_choose, b4_typed_parser_table,
        b4_small_parser-table, b4_medium_parser_table, b4_large_parser_table,
        b4_encode_bytes, b4_encode_shorts, b4_encode_ints, b4_encode_Strings,
        b4_encode_Strings_count, b4_extract_strings_re, b4_java_char,
        b4_integral_parser_table): New.
        * data/lalr1.java (yypact_, yydefact_, yypgoto_, yydefgoto_,
        yytable_, yycheck_, yystos_, yytoken_number_, yyr1_, yyr2_, yyrhs_
        yyprhs_, yyrline_, yytranslate_table_): Use b4_integral_parser_table.
        (yytname_): Use b4_typed_parser_table.
        (yy_decode_bytes, yy_decode_shorts, yy_decode_ints,
        yy_decode_Strings): New.
        * doc/bison.texinfo (Java Bison Interface): Add recommendations
        for resolving Java's ``code too large'' error.
        (Java Declarations Summary): Document %define parser_tables.
        * tests/java.at (Java Calculator): Test %define parser_table "medium"
        and %define parser_table "large".




 data/java.m4      |   19 ++++++++++++
 data/lalr1.java   |   82 +++++++++-------------------------------------------
 doc/bison.texinfo |    6 ++++
 3 files changed, 40 insertions(+), 67 deletions(-)


2008-11-06  Di-an Jan  <address@hidden>

        Workaround Java's ``code too large'' problem for parser tables
        in most cases, by using one function per initialization.
        * data/java.m4 (b4_typed_parser_table, b4_integral_parser_table): New.
        * data/lalr1.java (yypact_, yydefact_, yypgoto_, yydefgoto_,
        yytable_, yycheck_, yystos_, yytoken_number_, yyr1_, yyr2_, yyrhs_
        yyprhs_, yyrline_, yytranslate_table_): Use b4_integral_parser_table.
        (yytname_): Use b4_typed_parser_table.
        * doc/bison.texinfo (Java Bison Interface): Add note on Java's
        ``code too large'' error.

Attachment: java-parser_tables.patch
Description: Text document

Attachment: java-static-init.patch
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]