[antlr-interest] Antlr v2 conflict

Jim Idle jimi at temporal-wave.com
Wed Jul 25 07:22:08 PDT 2012


It sounds like you are treating all keywords as reserved words and so not allowing them to be identifiers. You will need to change your rules. 

Instead of referencing say ID directly use a parser rule id and add the keywords that can be ID in to the rule:

id : ID | KEY1 | KEY2 ....

You can change the token type of the keywords in that rule.  You may need to add predicates to avoid ambiguity warnings. 

Jim

On Jul 25, 2012, at 4:29 AM, Daniela da Cruz <danieladacruz at gmail.com> wrote:

> Hi
> 
> I am developing a grammar for Objective-C using Antlr v2.7 (unfortunately
> v3 is not an option).
> 
> The problem I am facing is that a type name can be a builtin type or a
> Cocoa type of a type defined using typedefs. This causes a conflict with
> the name of a variable that is also an Identifier.
> 
> Any idea of how can I solve this conflict?
> 
> thanks
> daniela
> 
> 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