Interactive Antlr
I'm trying to write a simple interactive (using System.in as source) language using antlr, and I have a few problems with it. The examples I've found on the web are all using a per line cycle, e.g.: while(readline) result = parse(line) doStuff(result) But what if I'm writing something like pascal/smtp/etc, with a "first line" looks like X requirment? I know it can be checked in doStuff, but I think logically it is part of the syntax. Or what if a command is split into multiple lines? I can try while(readline) lines.add(line) try result = parse(lines) lines = [] doStuff(result) catch nop But