[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: problem with lexer.dat



Pascal AUDANT wrote:

Greetings everyone,

Btw, thanx alot for your help AND patience.

I have now constructed my min grammar file which goes like :

Package test;

Tokens

a = 'a';

b = 'b';

Productions

s = a s [second]:a |

{alternative_two} b;

I generated all my classes and I implemented them in a main class …

However when I try to run the program I obtain the following error from the lexer.java class :

"The file \"lexer.dat\" is either missing or corrupted."

To make sure that the lexer.dat file is not missing I have put it in C: and change the code to :

new BufferedInputStream(

Lexer.class.getResourceAsStream("c:/lexer.dat")));

However I still obtain the same error msg (The error occurs as soon as lexer tries to read the lexer.dat file in int length = s.readInt();

As always your help is really appreciated

Pascal

Hi Pascal, All,

As mentioned by the SableCC error message, i think that your problem is related to corruption of the file lexer.dat.
You do not need to move this file.
What you can do is :
first, re-build SableCC(ant clean; ant jar).
then, generate the classes for your grammar by running SableCC. Before that, make sure to remove old generated files if necessary.


I hope this can help you,

Cheers,

kevin