problem with declaration grammar?

jerry quinn jlquinn at optonline.net
Wed Feb 18 19:25:08 PST 2009


Hi there,

I'm not sure if I'm missing something, but I'm having trouble seeing that a simple declaration will parse correctly with the D grammar.

If we take a declaration statment like:

int x = 3;

we have (my best guess):

DeclarationStatement -> Declaration
Declaration -> Decl
Decl -> BasicType Declarators ;
BasicType -> int
Declarators -> DeclaratorInitializer
DeclaratorInitializer -> Declarator = Initializer
Declarator -> BasicType2 Identifier
BasicType2 -> ????

I'm thinking that BasicType2 is optional here, rather than required as the grammar shows.  Is that correct?

Thanks
Jerry





More information about the Digitalmars-d mailing list