[antlr-interest] java : code too large for try statement => use another language?
Johannes Luber
jaluber at gmx.de
Fri Jul 18 10:02:38 PDT 2008
Laura Adam schrieb:
> Hello,
>
> I am implementing in Anltr through Java, a program that takes a DNA sequence as input and recognizes the different parts such as promoters, linkers...
>
> Those parts are thousands letters long.
> I used rules like :
>
> E0020 :
> ("atggtgagcaagggcgaggagctgttcaccggggtggtgcccatcctggtcgagctggacggcgacgtgaacggccacaagttcagcgtgtccggcgagggcgagggcgatgccacctacggcaagctgaccctgaagttcatctgcaccaccggcaagctgcccgtgccctggcccaccctcgtgaccaccctgacctggggcgtgcagtgcttcagccgctaccccgaccacatgaagcagcacgacttcttcaagtccgccatgcccgaaggctacgtccaggagcgcaccatcttcttcaaggacgacggcaactacaagacccgcgccgaggtgaagttcgagggcgacaccctggtgaaccgcatcgagctgaagggcatcgacttcaaggaggacggcaacatcctggggcacaagctggagtacaactacatcagccacaacgtctatatcaccgccgacaagcagaagaacggcatcaaggccaacttcaagatccgccacaacatcgaggacggcagcgtgcagctcgccgaccactaccagcagaacacccccatcggcgacggccccgtgctgctgcccgacaaccactacctgagcacccagtccgccctgagcaaagaccccaacgagaagcgcgatcacatggtcctgctggagttcgtgaccgccgccgggatcactctcggcatggacgagctgtacaagtaataa");
>
> E0022 :
> ("atggtgagcaagggcgaggagctgttcaccggggtggtgcccatcctggtcgagctggacggcgacgtgaacggccacaagttcagcgtgtccggcgagggcgagggcgatgccacctacggcaagctgaccctgaagttcatctgcaccaccggcaagctgcccgtgccctggcccaccctcgtgaccaccctgacctggggcgtgcagtgcttcagccgctaccccgaccacatgaagcagcacgacttcttcaagtccgccatgcccgaaggctacgtccaggagcgcaccatcttcttcaaggacgacggcaactacaagacccgcgccgaggtgaagttcgagggcgacaccctggtgaaccgcatcgagctgaagggcatcgacttcaaggaggacggcaacatcctggggcacaagctggagtacaactacatcagccacaacgtctatatcaccgccgacaagcagaagaacggcatcaaggccaacttcaagatccgccacaacatcgaggacggcagcgtgcagctcgccgaccactaccagcagaacacccccatcggcgacggccccgtgctgctgcccgacaaccactacctgagcacccagtccgccctgagcaaagaccccaacgagaagcgcgatcacatggtcctgctggagttcgtgaccgccgccgggatcactctcggcatggacgagctgtacaagaggcctgctgcaaacgacgaaaactacgctttagtagcttaataa");
>
>> If I want a 1000 lookahead characters the file.g is ok. I have no lexical nondeterminism. But when I want to use the file.g with my test_lexer.java I have that error from java: "code too large for try statement".
>> If I put a 200 lookahead characters I have lexical nondeterminism but I can compile and run the java program (I don't get the result I want of course).
>
> --> What can I do?
> I think I could add intermediates in my rules but it would be long (I thought to make packs of 4 or 5 letters), non general, and not friendly to user. I don't really like that solution.
> Maybe I should turn to another language such as C. Will I have the same problem?
>
> (That possible I misunderstood how Antlr works and how to use it. I've never worked on parsers before.)
>
> Laura Adam
>
I'm not sure if there is a good solution to your problem while still
staying in Java (I leave that to others) I wonder why you want to switch
from Java to C. If performance doesn't seem to be an issue, why don't
you go to C# (which doesn't have this problem)? It's my impression that
using C has an extra learning curve and may be more labarious than
Java/C#. (Jim may correct on that. :) Besides, C# is also
object-orientated and more similar to Java to C.
Johannes
More information about the antlr-interest
mailing list