[antlr-interest] Proper way to run the parser and lexer as a shell with Antlr 3
Terence Parr
parrt at cs.usfca.edu
Sun May 6 12:32:17 PDT 2007
On May 5, 2007, at 10:35 PM, Bruce Trask wrote:
> Hello,
>
> What is the proper way to run the lexer and parser in a loop so it
> can behave as "shell", taking input from System.in? I have tried
> some different attempts but am having some trouble with the input
> streams getting closed ?
Hi. By default, ANTLR consumes all input to fill buffer. Therefore,
you need to parse line-by-line. I.e.,
while not EOF
fetch a line
create token stream from line
parse
Ter
More information about the antlr-interest
mailing list