[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
I have a octets stream, on which I can not use the standard Lexer. In fact, I
have a 2000 C code to read this octets stream.
So my idea is to use (via Java Native Interface or to convert from C to Java)
this C program, that will produce a Vector of tockens. On this vector, I can
easyly use the SableCC parser to understand the orginal octets stream.
So my question, what must I do to write my own lexer?
I must write lexer.lexer, lexer.peek, lexer.next, getToken.
As my input is a vector of tockens, I do not have to write a getchar, pushback
Notice that my lexer can not produce lexer error (lexer errors are in fact
generated by the C program).
>From my point of view, getToken will convert "C data" to Java Token (and then I
have to create lexer.newxx). I do not need Pushback as my data are "pre lexer".
Have you any idea ?