Since some days I'm using sablecc to produce a small compiler.
I experienced the following problem: if the target directory of the compiled classes is different from the sources' directory, the lexer.dat file is reported as corrupted or missing, even after it has moved to the classes directory.
1. I produce my compiler sources in the directory 'src' (package myPackage)
> java -jar sablecc.jar src\myGrammar.grammar
2. Compile and store the classes in directory 'classes'
> javac -sourcepath src -d classes src\myPackage\*.java
3. move or copy the lexer.dat file
> copy src\myPackage\lexer\lexer.dat classes\myPackage\lexer
4. I try to execute my compiler (after adding a myCompiler main class..)
> cd classes
> java myPackage.myCompiler
The file "parser.dat" is either missing or corrupted.
In other words, seems like the lexer.dat file is sensible to the directory where it has been created..
In fact producing and compiling in the same directory doesn't give any trouble...
All this at least on my configuration (on a win2000 system).
The obvious workaround consists of produce the lexer.dat in the directory where the classes are stored.
Please note that this problem can be quite nerving in case you merge your produced sources to a project developed with an IDE (like e.g. JBuilder in my case). The produced classes are always stored on a separated directory from sources..
I excuse in advance if all this has already been reported ;-)
If not I would appreciate any comment or suggestion..