[antlr-interest] AntlrJavaToCs tool BIG PROBLEM NEED HELP

Terence Parr parrt at cs.usfca.edu
Tue Mar 20 16:35:53 PDT 2007


Only java has no static arrays.  C# can just define them.  Java uses  
code to initialize arrays and so explodes the 64k code limit per init  
method of class.

Ter
On Mar 20, 2007, at 4:27 PM, Liviu U wrote:

> Hi guys,
>
>
> My bold project seem to be doomed to an early death...I cannot  
> figure it out how following code should be translated.
> the methods: unpackEncodedString,  
> unpackEncodedStringToUnsignedChars have no match in Antlr C#  
> library, they are not present in DFA class.
>
>
> class DFA19 : DFA {
>         public DFA19(BaseRecognizer recognizer) {
>             this.recognizer = recognizer;
>             this.decisionNumber = 19;
>             this.eot = DFA.unpackEncodedString(DFA19_eotS);
>             this.eof = DFA.unpackEncodedString(DFA19_eofS);
>             this.min = DFA.unpackEncodedStringToUnsignedChars  
> (DFA19_minS);
>             this.max = DFA.unpackEncodedStringToUnsignedChars 
> (DFA19_maxS);
>             this.accept = DFA.unpackEncodedString(DFA19_acceptS);
>             this.special = DFA.unpackEncodedString(DFA19_specialS);
>             int numStates = DFA19_transition.length;
>             this.transition = new short[numStates][];
>             for (int i=0; i<numStates; i++) {
>                 transition[i] = DFA.unpackEncodedString 
> (DFA19_transition[i]);
>             }
>         }
>         public String getDescription() {
>             return "769:1: FloatingPointLiteral : ( ( '0' .. '9' )+  
> '.' ( '0' .. '9' )* ( Exponent )? ( FloatTypeSuffix )? |  
> '.' ( '0' .. '9' )+ ( Exponent )? ( FloatTypeSuffix )? | ( '0' ..  
> '9' )+ Exponent ( FloatTypeSuffix )? | ( '0' .. '9' )+  
> ( Exponent )? FloatTypeSuffix );";
>         }
>     }
>
> It seems that the C# code generation would be here very different  
> from Java version, which is too bad.
> Can anyone shed some light? Terr?
>
> Regards
> Liviu
>



More information about the antlr-interest mailing list