www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13538] New: Divide old C style syntax from D style grammar rule


          Issue ID: 13538
           Summary: Divide old C style syntax from D style grammar rule
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: spec
          Severity: normal
          Priority: P1
         Component: websites
          Assignee: nobody puremagic.com
          Reporter: k.hara.pg gmail.com

Current declaration grammar contains both D style syntax and C style one.

    StorageClasses_opt BasicType Declarators ;


    BasicType2_opt ( Declarator ) DeclaratorSuffixes_opt
    BasicType2_opt Identifier DeclaratorSuffixes_opt    // [x]


    [ ]
    [ AssignExpression ]
    [ Type ]
    Parameters MemberFunctionAttributes_opt
    TemplateParameters Parameters MemberFunctionAttributes_opt Constraint_opt

The grammar [x] accept both:
   int[] var
   int var[]

But it's confusing, and hard to understand what the grammar will accept.
Instead of mixing C style grammar rules under the one "Declarator", I'd propose
to separate them into "AltDeclarator".

And finally we can easily say that the AltDeclarator will be deprecated.

Sep 26 2014