[ragel-users] [PATCH] repost: improvements to rlgen-java

Adrian Thurston thurs... at cs.queensu.ca
Thu Jan 3 02:28:42 UTC 2008


Thanks David,

I was able to try out the patch. It slows the initialization of static data a little, but I think it is worth it. In addition to eliminating debug data it is easier on the compiler. During my testing of the existing initialization code I was a able to cause javac to barf on an out-of-memory error probably because the parser was busy making deep parse trees for all the a[x] = y statements. Your patch eliminates that problem.

Adrian
-----Original Message-----
From: "David Waite" <dwaite at gmail.com>

Date: Mon, 31 Dec 2007 09:56:18 
To:ragel-users at googlegroups.com
Subject: [ragel-users] [PATCH] repost: improvements to rlgen-java


The following patch changes the Java generation a bit: 

- Array row/max are changed slightly to 12/8184 based on 80 column 
display. This was just my own preference (some might prefer 10  
columns, some would prefer the power-of-2-edness of 8 columns).  Toss 
it if desired. 

- Arrays are generated with an array constructor rather than a large 
block of statement constructors. This reduced my packaged JAR size by  
14k for a relatively simple JSON vocabulary with 68 states. 
- Arrays are generated with whitespace padding in code for 
readability. 
- Array overflow (over the SAIIC limit) is done by creating multiple 
 functions with numbered prefixes, then generating a combine_<name> 
function which builds a new array using new and arraycopy over all the 
previous init_<name>_<number> functions. 

-David Waite  
  
 


More information about the ragel-users mailing list