[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Sablecc-user] Modify the grammar file
Merci bien Etienne, I have solved the problem.
Actually, when defining some new keywords one should copy the 2 very
important files: lexer.dat and parser.dat to the lexer and parser class
directories.
About recompiling all the files, it is fine, because I make the compile
commands explicitly in a script, then run the script. So they're all
done (by checking the time of class files)
Thank you.
Duy.
Etienne Gagnon wrote:
Hi D.,
Have you tried deleting all class files then recompiling all Java
sources?
Sometimes the Java compiler does not recompile all classes, and this can
cause problems.
If this does not help, you will need to provide us with more information
(like the grammar file).
Etienne
VO Duc Duy wrote:
I wanted to add some new keyword in an existing compiler, so I added
it in Tokens, then Productions. Then I use sablecc (2.9) to
regenerate this modified grammar, then compile all the generated
files in node/analysis/parser/lexer, they are all ok. But when I run
the parser, it always shows the exception like:
java.lang.ClassCastException
at parser.Parser.new51(Parser.java:1058)
at parser.Parser.parse(Parser.java:296)
I didn't change anything in the input file, I didn't use my new
keyword in the input file yet, but it always shows this exception.
Anybody has idea of this error?
Or please tell me how to add some new keywords in an existing grammar
file?
Thank you in advance.
D.