[antlr-interest] read from socket
Johannes Luber
jaluber at gmx.de
Tue Jul 8 02:51:31 PDT 2008
Kahina BOUARAB schrieb:
> First, excuse me for my bad english.
> I've a thread which reads commands from a socket. I would like these
> commands to be parsed by an ANTLR parser.
> e.g: a part of grammar:
> DR()
> RQ()
> TQ()*
> FR()
>
> the probleme is: i receive these commands separately from socket.
> So if i parse DR, the parser tell me
>
> BR.recoverFromMismatchedToken
> line 0:-1 mismatched input '<EOF>' expecting 'RQ('
>
> because the parser find EOF instead of RQ.
>
> i can't accumulate these commands to give a complete block to the parser.
> e.g DR() RQ() TQ() FR()
>
> How can i do to parse these commands properly?
>
> thanks
>
>
>
Currently the lexer requires the entire input upfront because all tokens
are generated before the parser sees them. You have to create a new
class which only generates tokens on a need-to-have basis. I believe the
archives and maybe the wiki contain some further hints.
Johannes
More information about the antlr-interest
mailing list