D Grammar

Top level symbols:

1 Lexical
EndOfFile ::=
|
\u0000
|
\u001A
EndOfLine ::=
\u000D
|
\u000A
|
\u000D \u000A
|
WhiteSpace ::=
|
Space ::=
\u0020 | \u0009 | \u000B | \u000C | EndOfLine | Comment
Comment ::=
/* Characters */
|
|
/+ Characters +/
Identifier ::=
|
IdentifierChars ::=
|
IdentifierStart ::=
_ | Letter
IdentifierChar ::=
IdentiferStart | Digit
StringLiteral ::=
|
|
SingleQuotedString ::=
SingleQuotedCharacter ::=
Character | EndOfLine
DoubleQuotedString ::=
DoubleQuotedCharacter ::=
Character | EscapeSequence | EndOfLine
EscapeSequence ::=
\'
|
\"
|
\?
|
\\
|
\a
|
\b
|
\f
|
\n
|
\r
|
\t
|
\v
|
|
|
|
|
|
IntegerLiteral ::=
|
Integer ::=
Decimal | Binary | Octal | Hexadecimal | HexadecimalH
IntegerSuffix ::=
l | L | u | U | lu | Lu | lU | LU | ul | uL | Ul | UL
Decimal ::=
0
|
|
Binary ::=
|
Octal ::=
Hexadecimal ::=
|
HexadecimalH ::=
|
FloatLiteral ::=
|
|
|
Float ::=
DecimalFloat | HexFloat
FloatSuffix ::=
f | F | l | L
ImaginarySuffix ::=
i | I
Keyword ::=
abstract | alias | align | asm | assert | auto | bit | body | break | byte | case | cast | catch | cent | char | class | complex | const | continue | debug | default | delegate | delete | deprecated | do | double | else | enum | export | extended | extern | false | final | finally | float | for | super | null | new | short | int | long | imaginary | if | switch | synchronized | return | goto | struct | interface | import | static | override | in | out | inout | private | protected | public | invariant | this | throw | true | try | typedef | ubyte | ucent | uint | ulong | union | ushort | version | void | volatile | wchar | while | with
Token ::=
Identifier | StringLiteral | IntegerLiteral | FloatLiteral | Keyword | / | /= | . | .. | ... | & | &= | && | | | |= | || | - | -= | -- | + | += | ++ | < | <= | << | <<= | <> | <>= | > | >= | >>= | >>>= | >> | >>> | ! | != | !== | !<> | !<>= | !< | !<= | !> | !>= | ( | ) | [ | ] | { | } | ? | , | ; | : | $ | = | == | === | * | *= | % | %= | ^ | ^= | ~ | ~=
Pragma ::=
|
Filespec ::=
2 Modules
Module ::=
|
DeclDefs ::=
|
DeclDef ::=
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;
ModuleDeclaration ::=
module ModuleName ;
ModuleName ::=
|
ImportDeclaration ::=
import ModuleNameList ;
ModuleNameList ::=
|
3 Declarations
Declaration ::=
typedef Decl
|
alias Decl
|
Decl ::=
const Decl
|
static Decl
|
final Decl
|
synchronized Decl
|
deprecated Decl
|
|
Declarators ::=
|
BasicType ::=
void | bit | byte | ubyte | short | ushort | int | uint | long | ulong | cent | ucent | float | double | extended | imaginary | complex | char | wchar
4 Properties
IntegralProperty ::=
.init | .size | .max | .min | .sign
FloatingPointProperty ::=
.init | .size | .infinity | .nan | .sign | .isnan | .isinfinite | .isnormal | .digits | .epsilon | .mantissa | .maxExp | .max | .min
EnumProperties ::=
.min | .max | .size
5 Attributes
AttributeSpecifier ::=
|
AttributeElseSpecifier ::=
|
|
Attribute ::=
|
|
deprecated
|
private
|
protected
|
public
|
export
|
static
|
final
|
override
|
abstract
|
const
|
auto
AttributeElse ::=
|
DeclDefBlock ::=
|
{ }
|
LinkageAttribute ::=
extern
|
extern ( LinkageType )
LinkageType ::=
C | D | Windows | Pascal
AlignAttribute ::=
align
|
align ( Integer )
DebugAttribute ::=
debug
|
debug ( Integer )
|
debug ( Identifier )
6 Expressions
Expression ::=
|
AssignExpression ::=
|
|
|
|
|
|
|
|
|
|
|
|
|
ConditionalExpression ::=
|
OrOrExpression ::=
|
AndAndExpression ::=
|
OrExpression ::=
|
XorExpression ::=
|
AndExpression ::=
|
EqualExpression ::=
|
|
|
|
RelExpression ::=
|
|
|
|
|
|
|
|
|
|
|
|
|
ShiftExpression ::=
|
|
|
AddExpression ::=
|
|
|
MulExpression ::=
|
|
|
UnaryExpression ::=
|
|
|
|
|
|
|
|
|
|
|
|
PostfixExpression ::=
|
|
|
|
|
PrimaryExpression ::=
|
this
|
super
|
null
|
true
|
false
|
|
|
|
AssertExpression ::=
assert ( Expression )
ArgumentList ::=
|
NewExpression ::=
|
|
|
|
|
Stars ::=
|
*
|
7 Statements
Statement ::=
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LabelledStatement ::=
BlockStatement ::=
{ }
|
StatementList ::=
|
ExpressionStatement ::=
DeclarationStatement ::=
IdentifierList ::=
|
Variable ::=
|
IfStatement ::=
|
WhileStatement ::=
DoStatement ::=
do Statement while ( Expression )
ForStatement ::=
Initialize ::=
empty | Expression | Declaration
Test ::=
empty | Expression
Increment ::=
empty | Expression
SwitchStatement ::=
CaseStatement ::=
DefaultStatement ::=
default: Statement
ContinueStatement ::=
continue;
|
continue Identifier ;
BreakStatement ::=
break;
|
break Identifier ;
ReturnStatement ::=
return;
|
return Expression ;
GotoStatement ::=
goto Identifier ;
WithStatement ::=
SynchronizeStatement ::=
synchronized Statement
|
synchronized ( Expression ) Statement
TryStatement ::=
|
|
Catches ::=
|
|
LastCatch ::=
Catch ::=
ThrowStatement ::=
throw Expression ;
AsmStatement ::=
asm { }
|
AsmInstructionList ::=
|
8 Structs, Unions, Enums
AggregateDeclaration ::=
|
|
Tag ::=
struct | union
EnumDeclaration ::=
|
enum { EnumMembers }
|
enum identifier ;
EnumMembers ::=
|
|
EnumMember ::=
|
9 Classes
ClassDeclaration ::=
SuperClass ::=
InterfaceClass ::=
Identifier
ClassBody ::=
10 Interfaces
InterfaceDeclaration ::=
|
SuperInterfaces ::=
|
InterfaceBody ::=
11 Templates
TemplateDeclaration ::=
TemplateIdentifier ::=
Identifier
TemplateParameterList ::=
|
TemplateParameter ::=
TypeParameter | ValueParameter
TypeParameter ::=
|
ValueParameter ::=
|
TemplateInstance ::=
TemplateAliasDeclaration ::=
AliasIdentifier ::=
Identifier
TemplateArgumentList ::=
|
TemplateArgument ::=
|