|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
How to avoid using lexer.dat & parser.datHello, I am using SableCC 3 in a project having the target to
implement Design by contract in java (http://sourceforge.net/projects/jdefprog, refer to the SVN code when interested in taking a look). I would like to avoid using lexer.dat & parser.dat and instead have the "big arrays" initialized directly in the code (I have seen the generated files have the values but they are commented). So I wonder: there is an option to generate parser.java & lexer.java in a way to achieve this result? Thank you in advance, Federico Tomassetti _______________________________________________ SableCC-Discussion mailing list SableCC-Discussion@... http://lists.sablecc.org/listinfo/sablecc-discussion |
|
|
Re: How to avoid using lexer.dat & parser.datHi Federico,
You could uncomment the tables (and comment-out the static initializer code that loads the .dat files), but you will likely get either a compiler error, or a virtual machine error. I have created the .dat files because table initializers are transformed into code, in Java, and the bytecode specification limits methods to 65K bytes. For bigger grammars, SableCC generates tables that cause the <init> method (the bytecode method for static initialization) to exceed that size. Usually, you should not put generated *.java and *.dat class into your SVN repository. You should simply put the *.sablecc3 grammars and use an Ant script (ant.apache.org) to build your application, and copy the generated *.dat files along the *.class files. Etienne Federico Tomassetti wrote: > Hello, I am using SableCC 3 in a project having the target to > implement Design by contract in java > (http://sourceforge.net/projects/jdefprog, refer to the SVN code when > interested in taking a look). > > I would like to avoid using lexer.dat & parser.dat and instead have > the "big arrays" initialized directly in the code (I have seen the > generated files have the values but they are commented). So I wonder: > there is an option to generate parser.java & lexer.java in a way to > achieve this result Etienne M. Gagnon, Ph.D. SableCC: http://sablecc.org _______________________________________________ SableCC-Discussion mailing list SableCC-Discussion@... http://lists.sablecc.org/listinfo/sablecc-discussion |
|
|
Re: How to avoid using lexer.dat & parser.datEven disregarding the 64K issue, it makes sense to have the *.dat
files, as the initialization bytecode is not only slower¹, but also consumes more space, both on disc and in memory. (Some people actually use string literals as a workaround.) -- Niklas Matthies ¹) At least potentially. The SableCC code isn't the most efficient either. On Mon 2009-06-01 at 20:51h, Etienne M. Gagnon wrote on sablecc-discussion: > Hi Federico, > > You could uncomment the tables (and comment-out the static initializer > code that loads the .dat files), but you will likely get either a > compiler error, or a virtual machine error. I have created the .dat > files because table initializers are transformed into code, in Java, and > the bytecode specification limits methods to 65K bytes. For bigger > grammars, SableCC generates tables that cause the <init> method (the > bytecode method for static initialization) to exceed that size. > > Usually, you should not put generated *.java and *.dat class into your > SVN repository. You should simply put the *.sablecc3 grammars and use an > Ant script (ant.apache.org) to build your application, and copy the > generated *.dat files along the *.class files. > > Etienne > > Federico Tomassetti wrote: > > Hello, I am using SableCC 3 in a project having the target to > > implement Design by contract in java > > (http://sourceforge.net/projects/jdefprog, refer to the SVN code when > > interested in taking a look). > > > > I would like to avoid using lexer.dat & parser.dat and instead have > > the "big arrays" initialized directly in the code (I have seen the > > generated files have the values but they are commented). So I wonder: > > there is an option to generate parser.java & lexer.java in a way to > > achieve this result > > -- > Etienne M. Gagnon, Ph.D. > SableCC: http://sablecc.org > > > _______________________________________________ > SableCC-Discussion mailing list > SableCC-Discussion@... > http://lists.sablecc.org/listinfo/sablecc-discussion _______________________________________________ SableCC-Discussion mailing list SableCC-Discussion@... http://lists.sablecc.org/listinfo/sablecc-discussion |
| Free embeddable forum powered by Nabble | Forum Help |