[antlr-interest] Little grammar specification problem

Jim Idle jimi at temporal-wave.com
Tue Feb 1 09:18:29 PST 2011


You are confusing lexer rules with parser rules. Stand back and read
through the getting started articles on the Wiki and you will see what the
problem is.

Jim

> -----Original Message-----
> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> bounces at antlr.org] On Behalf Of Andrius Bentkus
> Sent: Tuesday, February 01, 2011 7:00 AM
> To: antlr-interest at antlr.org
> Subject: [antlr-interest] Little grammar specification problem
>
> Hello,
>
> I'm trying to write a very simple log parser with ANTLR to compare it
> to my current one (which is just a bunch of regexes).
> The problem that I'm facing is that I don't know how to parse random
> input.
> In my case the input looks something like this: "word1_word2"
>
>
> What I came by so far is this:
>   rVal: CO rString CO;
>   rString: rChar | rChar rString;
>   rChar: ( 'a'..'z' | '/' | '_' | '0'..'9' | '.' );
>   CO: '"';
>
> rVal should match the rule (imo), but I just get the error line 1:1 no
> viable alternative at input 'de_dust'.
> Maybe you guys got some better ideas, or could explain me why it
> doesn't.
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-
> email-address


More information about the antlr-interest mailing list