[Issue 1351] New: Discrepancies in the language specification

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Jul 20 13:15:42 PDT 2007


http://d.puremagic.com/issues/show_bug.cgi?id=1351

           Summary: Discrepancies in the language specification
           Product: D
           Version: unspecified
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: aziz.kerim at gmail.com


In the process of writing my own lexer and parser of the D programming
language, I have found plenty of discrepancies in the language specification
and I have some suggestions. Here we go:

.) module.html
The DeclDef rule has many subrules which should link to the page where they're
defined.
        DebugSpecification // Replace with ConditionalDeclaration
        VersionSpecification // ditto

.) declaration.html
Introduce a new rule "IntegralType" which will contain only the integral types
of D (bool - void from BasicType). This is useful for a subrule in
PrimaryExpression (see below.)
        IntegralType:
                bool
                byte
                ...
                void
        BasicType:
                IntegralType
                .IdentifierList
                IdentifierList
                Typeof
                Typeof . IdentifierList
        BasicType2:
                [ Expression .. Expression ] // Slice expression is missing.
        Declarator:
                () Declarator // Has a trailing space. Should be "( Declarator
)".
                Identifier DeclaratorSuffixes
                () Declarator  DeclaratorSuffixes // Should be "( Declarator )
DeclaratorSuffixes"
        DeclaratorSuffix:
                [ Expression .. Expression ] // Slice expression is missing.

.) attribute.html
Attribute:
        synchronized // missing
.) expression.html
EqualExpression:
        ShiftExpression
        ShiftExpression == ShiftExpression
        ShiftExpression != ShiftExpression
        ShiftExpression is ShiftExpression // This is covered in
IdentityExpression already.
        ShiftExpression !is ShiftExpression // ditto

UnaryExpression:
        NewExpression
        NewAnonClassExpression // Should be contained by NewExpression.
NewExpression:
        NewArguments ClassArguments BaseClasslistopt { DeclDefs } // Should be
removed and replaced by NewAnonClassExpression.

PostfixExpression:
        PostfixExpression . Identifier // Identifier should be replaced by
IdentifierList so that TemplateInstance is covered as well.

PrimaryExpression:
        Identifier // Should be replaced by IdentifierList
        .Identifier // Should be replaced by ". IdentifierList"
        BasicType . Identifier // BasicType should be replaced by IntegralType
as suggested above.
        typeof ( Expression ) // missing
        typeof ( Expression ) . IdentifierList // missing

KeyExpression:
        ConditionalExpression // Should be AssignExpression.

ValueExpression:
        ConditionalExpression // Should be AssignExpression.

FunctionLiteral // missing colon
        function Typeopt ( ParameterList )opt FunctionBody // Allows for
literals like "function int {}". Is this legal?

IsExpression:
        is ( Type Identifier ) // Doesn't allow for "is (int x[] == int[])"
        is ( Type Identifier : TypeSpecialization )
        is ( Type Identifier == TypeSpecialization )
TypeSpecialization:
        return // missing

.) class.html
Protection:
        private
        package
        public
        export // inheriting by export doesn't make any sense.

.) enum.html
EnumDeclaration:
        enum EnumBody // Allows for "enum;"

.) template.html
TemplateDeclaration:
        template TemplateIdentifier ( TemplateParameterList )
                { DeclDefs } // Should be on the above line.
TemplateParameterList // Has no colon.


-- 



More information about the Digitalmars-d-bugs mailing list