[antlr-interest] Antlr v2 conflict

Daniela da Cruz danieladacruz at gmail.com
Wed Jul 25 06:40:07 PDT 2012


Hi

I have a conflict because:

declaration: declaration_specifiers declarator;

declaration_specifiers: (type_qualifier | type_specifier)+

declarator: IDENT

type_specifier: "int" | ... | IDENT


both the type_specifier and declarator can be IDENT.

So, if I have "int a" it matches twice on type_specifier and it should be
one type_specifier and then declarator.

thanks
daniela

On Wed, Jul 25, 2012 at 1:57 PM, Mike Lischke <mike at lischke-online.de>wrote:

>
> Hey Daniela,
>
> Hi Mike.
> Thanks for your reply. But I can't see how rename the name it would solve
> the problem.
> Lets say I have the following:
>
> MyType var;
>
> This is a valid declaration in Objective-C, where MyType is the type name
> and var is the variable's name. So, both are identifiers.
>
> In the grammar I have:
>
> declaration: declaration_specifiers declarator
>
> where declaration_specifiers will be one more more type qualifiers or
> specifiers and declarator would be in last case a simple identifier.
>
>
> Where's the conflict you mentioned? An name conflict can happen when you
> have a rule or token using a name which is also used elsewhere (typical
> case for Obj-C is 'id', which is used for an identifier rule, but is also a
> reserved word).
>
> Mike
> --
> www.soft-gems.net
>
>


More information about the antlr-interest mailing list