[antlr-interest] Interactive processing of input
Bart Kiers
bkiers at gmail.com
Mon Apr 11 10:44:23 PDT 2011
On Mon, Apr 11, 2011 at 11:19 AM, NeoPhyte <20neophyte08 at gmail.com> wrote:
> Will this method allow me to process each line in an input file
> individually.
> Like if my grammar has multiple rules and I want to process each of these
> rules individually....
> Something like...
>
> say my grammar has following 3 individual parser rules
>
> rule1 : ....
> rule2 : ....
> rule3: ...
>
> final : (rule1|rule2|rule3)+;
>
> //rest of the lexer and parser rules
>
> and my i/o is
>
> read input for rule1
> show output for rule1
>
> read input for rule3
> show output for rule3
>
> read input for rule1
> show output for rule1
>
> an so on, until I use something like an EOF(ctrl-z)....
>
> with the method suggested by you, can I achieve this?...and if so can u plz
> provide a sample code for the same....
Hmm, I really don't know what you mean...
As long as you invoke the `final` method on your parser (which matches one
of: `rule1`, `rule2` or `rule3`), you're okay, AFAIK.
Regards,
Bart.
More information about the antlr-interest
mailing list