Yes, it takes quite a bit of practise, but you will find a great help in 
Terence Parr's books.

See the links below.

http://pragprog.com/titles/tpantlr/the-definitive-antlr-reference 

http://pragprog.com/titles/tpdsl/language-implementation-patterns 

Best regards, Ranco

________________________________________
From: [email protected] [[email protected]] on 
behalf of P.N. [[email protected]]
Sent: Tuesday, June 07, 2011 11:07 AM
To: [email protected]
Subject: Re: [antlr-interest] error(208)

Thank You, works great now!
I'm not used to writing parsers and/or lexers, so I'm still confusing
about it.

Kind regards
Peter


Ranco Marcus schrieb:
> Hello Peter,
>
> You should probably change the name of rule PV to lowercase pv, because it is 
> a parser rule and not a lexer rule.
>
> Best regards,
>
> Ranco
>
> ________________________________________
> From: [email protected] [[email protected]] on 
> behalf of P.N. [[email protected]]
> Sent: Tuesday, June 07, 2011 10:32 AM
> To: [email protected]
> Subject: [antlr-interest] error(208)
>
> Hello!
>
> Using the following rules for grammar (ESC_SEQ defined as fragment):
>
> root    :        object;
> object  :       '{' props '}';
> props   :       prop (',' prop)*;
> prop    :       ID ('=' PV | '+' | '-');
> PV      :       STRING | object | INT;
> ID      :       ('a'..'z'|'A'..'Z') ('a'..'z'|'A'..'Z'|'0'..'9'|'_')*;
> INT     :       '0' | ('1'..'9') ('0'..'9')*;
> WS      :       (' '|'\t'|'\r'|'\n') {$channel=HIDDEN;};
> STRING  :       '"' (ESC_SEQ | ~('\\'|'"'))* '"';
>
> When I try to generate the Java code, the following error message is shown:
> "error(208):  The following token definitions can never be matched
> because prior tokens match the same input: INT,STRING"
>
> Why do I get this message, as every lexical rule has its own starting
> character?
>
> Kind regards
>
> Peter
>
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: 
> http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: 
> http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>



List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

-- 
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.

Reply via email to