Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grammar railroad diagram #522

Open
mingodad opened this issue Dec 12, 2024 · 0 comments
Open

Grammar railroad diagram #522

mingodad opened this issue Dec 12, 2024 · 0 comments

Comments

@mingodad
Copy link

mingodad commented Dec 12, 2024

After fixing/converting the grammar at http://libdparse.dlang.io/grammar.html to an EBNF understood by (IPV4) https://rr.red-dove.com/ui or (IPV6) https://www.bottlecaps.de/rr/ui we can have a nice navigable railroad diagram (see instructions at the top bellow).

//
// EBNF to be viewd at
//    (IPV6) https://www.bottlecaps.de/rr/ui
//    (IPV4) https://rr.red-dove.com/ui
//
// Copy and paste this at one of the urls shown above in the 'Edit Grammar' tab
// then click the 'View Diagram' tab.
//

start ::= module

 addExpression ::=
       mulExpression
     | addExpression ('+' | '-' | '~') mulExpression

 aliasDeclaration ::=
       "alias" aliasInitializer (',' aliasInitializer)* ';'
     | "alias" storageClass* type declaratorIdentifierList ';'
     | "alias" storageClass* type Identifier '(' parameters ')' memberFunctionAttribute* ';'

 aliasAssign ::=
     Identifier '=' type

 aliasInitializer ::=
       Identifier templateParameters? '=' storageClass* type
     | Identifier templateParameters? '=' storageClass* type parameters memberFunctionAttribute*
     | Identifier templateParameters? '=' functionLiteralExpression

 aliasThisDeclaration ::=
     "alias" Identifier "this" ';'

 alignAttribute ::=
     "align" ('(' assignExpression ')')?

 andAndExpression ::=
       orExpression
     | andAndExpression "&&" orExpression

 andExpression ::=
       cmpExpression
     | andExpression '&' cmpExpression

 namedArgument ::=
     (Identifier ':')? assignExpression

 namedArgumentList ::=
     namedArgument (',' namedArgument?)*

 argumentList ::=
     assignExpression (',' assignExpression?)* ','?

 arguments ::=
     '(' namedArgumentList? ')'

 arrayInitializer ::=
       '[' ']'
     | '[' arrayMemberInitialization (',' arrayMemberInitialization?)* ']'

 arrayLiteral ::=
     '[' argumentList? ']'

 arrayMemberInitialization ::=
     (assignExpression ':')? nonVoidInitializer

 asmAddExp ::=
       asmMulExp
     | asmAddExp ('+' | '-') asmMulExp

 asmAndExp ::=
       asmEqualExp
     | asmAndExp '&' asmEqualExp

 asmBrExp ::=
       asmUnaExp
     | asmBrExp? '[' asmExp ']'

 asmEqualExp ::=
       asmRelExp
     | asmEqualExp ("==" | "!=") asmRelExp

 asmExp ::=
     asmLogOrExp ('?' asmExp ':' asmExp)?

 asmInstruction ::=
       Identifier
     | "align" IntegerLiteral
     | "align" Identifier
     | Identifier ':' asmInstruction
     | Identifier operands
     | "in" operands
     | "out" operands
     | "int" operands
     | ';'

 asmLogAndExp ::=
     asmOrExp
     asmLogAndExp "&&" asmOrExp

 asmLogOrExp ::=
       asmLogAndExp
     | asmLogOrExp "||" asmLogAndExp

 asmMulExp ::=
       asmBrExp
     | asmMulExp ('*' | '/' | '%') asmBrExp

 asmOrExp ::=
       asmXorExp
     | asmOrExp '|' asmXorExp

 asmPrimaryExp ::=
       IntegerLiteral
     | FloatLiteral
     | StringLiteral
     | register
     | register ':' AsmExp
     | IdentifierChain
     | '$'
     | "this"
     | "__LOCAL_SIZE"

 asmRelExp ::=
       asmShiftExp
     | asmRelExp (('<' | "<=" | '>' | ">=") asmShiftExp)?

 asmShiftExp ::=
     asmAddExp
     asmShiftExp ("<<" | ">>" | ">>>") asmAddExp

 asmStatement ::=
     "asm" functionAttributes? '{' ( asmInstruction+ | gccAsmInstruction+ ) '}'

 asmTypePrefix ::=
       Identifier Identifier?
     | "byte" Identifier?
     | "short" Identifier?
     | "int" Identifier?
     | "float" Identifier?
     | "double" Identifier?
     | "real" Identifier?

 asmUnaExp ::=
       asmTypePrefix asmExp
     | Identifier asmExp
     | '+' asmUnaExp
     | '-' asmUnaExp
     | '!' asmUnaExp
     | '~' asmUnaExp
     | asmPrimaryExp

 asmXorExp ::=
       asmAndExp
     | asmXorExp '^' asmAndExp

 assertArguments ::=
     assignExpression (',' assignExpression)* ','?

 assertExpression ::=
     "assert" '(' assertArguments ')'

 assignExpression ::=
     ternaryExpression (assignOperator assignExpression)?

 assignOperator ::=
       '='
     | ">>>="
     | ">>="
     | "<<="
     | "+="
     | "-="
     | "*="
     | "%="
     | "&="
     | "/="
     | "|="
     | "^^="
     | "^="
     | "~="

 assocArrayLiteral ::=
     '[' keyValuePairs ']'

 atAttribute ::=
       '@' Identifier
     | '@' Identifier '(' argumentList? ')'
     | '@' '(' argumentList ')'
     | '@' templateInstance
     | '@' templateSingleArgument

 attribute ::=
       pragmaExpression
     | alignAttribute
     | deprecated
     | atAttribute
     | linkageAttribute
     | "export"
     | "package" ('(' IdentifierChain ')')?
     | "private"
     | "protected"
     | "public"
     | "static"
     | "extern"
     | "abstract"
     | "final"
     | "override"
     | "synchronized"
     | "auto"
     | "scope"
     | "const"
     | "immutable"
     | "inout"
     | "shared"
     | "_gshared"
     | "nothrow"
     | "pure"
     | "ref"
     | "throw"

 attributeDeclaration ::=
     attribute ':'

 autoDeclaration ::=
     storageClass+  autoDeclarationPart (',' autoDeclarationPart)* ';'

 autoDeclarationPart ::=
     Identifier templateParameters? '=' initializer

 blockStatement ::=
     '{' declarationsAndStatements? '}'

 breakStatement ::=
     "break" Identifier? ';'

 baseClass ::=
     type2

 baseClassList ::=
     baseClass (',' baseClass)*

 builtinType ::=
       "bool"
     | "byte"
     | "ubyte"
     | "short"
     | "ushort"
     | "int"
     | "uint"
     | "long"
     | "ulong"
     | "char"
     | "wchar"
     | "dchar"
     | "float"
     | "double"
     | "real"
     | "ifloat"
     | "idouble"
     | "ireal"
     | "cfloat"
     | "cdouble"
     | "creal"
     | "void"

 caseRangeStatement ::=
     "case" assignExpression ':' ".." "case" assignExpression ':' declarationsAndStatements

 caseStatement ::=
     "case" argumentList ':' declarationsAndStatements

 castExpression ::=
     "cast" '(' (type | castQualifier)? ')' unaryExpression

 castQualifier ::=
       "const"
     | "const" "shared"
     | "immutable"
     | "inout"
     | "inout" "shared"
     | "shared"
     | "shared" "const"
     | "shared" "inout"

 catch ::=
     "catch" '(' type Identifier? ')' declarationOrStatement

 catches ::=
       catch+
     | catch* lastCatch

 classDeclaration ::=
       "class" Identifier ';'
     | "class" Identifier (':' baseClassList)? structBody
     | "class" Identifier templateParameters constraint? (structBody | ';')
     | "class" Identifier templateParameters constraint? (':' baseClassList)? structBody
     | "class" Identifier templateParameters (':' baseClassList)? constraint? structBody

 cmpExpression ::=
       shiftExpression
     | equalExpression
     | identityExpression
     | relExpression
     | inExpression

 compileCondition ::=
       versionCondition
     | debugCondition
     | staticIfCondition

 conditionalDeclaration ::=
       compileCondition declaration
     | compileCondition '{' declaration* '}'
     | compileCondition ':' declaration+
     | compileCondition declaration "else" ':' declaration*
     | compileCondition declaration "else" declaration
     | compileCondition declaration "else" '{' declaration* '}'
     | compileCondition '{' declaration* '}' "else" declaration
     | compileCondition '{' declaration* '}' "else" '{' declaration* '}'
     | compileCondition '{' declaration* '}' "else" ':' declaration*
     | compileCondition ':' declaration+ "else" declaration
     | compileCondition ':' declaration+ "else" '{' declaration* '}'
     | compileCondition ':' declaration+ "else" ':' declaration*

 conditionalStatement ::=
     compileCondition declarationOrStatement ("else" declarationOrStatement)?

 constraint ::=
     "if" '(' expression ')'

 constructor ::=
     "this" templateParameters? parameters memberFunctionAttribute* constraint? (functionBody | ';')

 continueStatement ::=
     "continue" Identifier? ';'

 debugCondition ::=
     "debug" ('(' (IntegerLiteral | Identifier) ')')?

 debugSpecification ::=
     "debug" '=' (Identifier | IntegerLiteral) ';'

 declaration ::=
       attribute* declaration2
     | attribute+ '{' declaration* '}'

  declaration2 ::=
       aliasDeclaration
     | aliasAssign
     | aliasThisDeclaration
     | anonymousEnumDeclaration
     | attributeDeclaration
     | classDeclaration
     | conditionalDeclaration
     | constructor
     | debugSpecification
     | destructor
     | enumDeclaration
     | eponymousTemplateDeclaration
     | functionDeclaration
     | importDeclaration
     | interfaceDeclaration
     | invariant
     | mixinDeclaration
     | mixinTemplateDeclaration
     | pragmaDeclaration
     | sharedStaticConstructor
     | sharedStaticDestructor
     | staticAssertDeclaration
     | staticConstructor
     | staticDestructor
     | staticForeachDeclaration
     | staticForeachStatement
     | structDeclaration
     | templateDeclaration
     | unionDeclaration
     | postblit
     | unittest
     | variableDeclaration
     | versionSpecification

 declarationsAndStatements ::=
     declarationOrStatement+

 declarationOrStatement ::=
       declaration
     | statement

 declarator ::=
       Identifier
     | Identifier '=' initializer
     | ':' bitfieldWidth
     | Identifier ':' bitfieldWidth
     | Identifier ':' bitfieldWidth '=' initializer
     | Identifier templateParameters '=' initializer

 declaratorIdentifierList ::=
     Identifier (',' Identifier)*

 bitfieldWidth ::=
     ternaryExpression

 defaultStatement ::=
     "default" ':' declarationsAndStatements

 deleteExpression ::=
     "delete" unaryExpression

 deprecated ::=
     "deprecated" ('(' StringLiteral+ ')')?

 destructor ::=
     '~' "this" '(' ')' memberFunctionAttribute* (functionBody | ';')

 doStatement ::=
     "do" statementNoCaseNoDefault "while" '(' expression ')' ';'

 enumBody ::=
     '{' enumMember (',' enumMember?)* '}'

 anonymousEnumMember ::=
       type Identifier '=' assignExpression
     | Identifier '=' assignExpression
     | Identifier

 anonymousEnumDeclaration ::=
     "enum" (':' type)? '{' anonymousEnumMember+ '}'

 enumDeclaration ::=
       "enum" Identifier (':' type)? ';'
     | "enum" Identifier (':' type)? enumBody

 enumMemberAttribute ::=
       atAttribute
     | deprecated

 enumMember ::=
     (enumMemberAttribute)* Identifier ('=' assignExpression)?

 eponymousTemplateDeclaration ::=
     "enum" Identifier templateParameters '=' assignExpression ';'

 equalExpression ::=
     shiftExpression ("==" | "!=") shiftExpression

 expression ::=
     assignExpression (',' assignExpression)*

 expressionStatement ::=
     expression ';'

 finalSwitchStatement ::=
     "final" switchStatement

 finally ::=
     "finally" declarationOrStatement

 forStatement ::=
     "for" '(' (declaration | statementNoCaseNoDefault) expression? ';' expression? ')' declarationOrStatement

 staticForeachDeclaration ::=
       "static" ("foreach" | "foreach_reverse") '(' foreachTypeList ';' expression ')' (declaration | '{' declaration* '}')
     | "static" ("foreach" | "foreach_reverse") '(' foreachType ';' expression ".." expression ')' (declaration | '{' declaration* '}')

 staticForeachStatement ::=
     "static" foreachStatement

 foreachStatement ::=
       ("foreach" | "foreach_reverse") '(' foreachTypeList ';' expression ')' declarationOrStatement
     | ("foreach" | "foreach_reverse") '(' foreachType ';' expression ".." expression ')' declarationOrStatement

 foreachType ::=
       ("ref" | "alias" | "enum" | "scope" | typeConstructor)* type? Identifier

 foreachTypeList ::=
     foreachType (',' foreachType)*

 functionAttribute ::=
       atAttribute
     | "pure"
     | "nothrow"

 functionBody ::=
       specifiedFunctionBody
     | shortenedFunctionBody
     | missingFunctionBody

 functionCallExpression ::=
       symbol arguments
     | unaryExpression arguments
     | type arguments

 functionContract ::=
       inOutContractExpression
     | inOutStatement

 functionDeclaration ::=
       (storageClass+ | type) Identifier parameters memberFunctionAttribute* (functionBody | ';')
     | (storageClass+ | type) Identifier templateParameters parameters memberFunctionAttribute* constraint? (functionBody | ';')

 functionLiteralExpression ::=
     | "delegate" "auto"? "ref"? type? (parameters functionAttribute*)? specifiedFunctionBody
     | "function" "auto"? "ref"? type? (parameters functionAttribute*)? specifiedFunctionBody
     | "auto"? "ref"? parameters functionAttribute* specifiedFunctionBody
     | specifiedFunctionBody
     | Identifier "=>" assignExpression
     | "function" "auto"? "ref"? type? parameters functionAttribute* "=>" assignExpression
     | "delegate" "auto"? "ref"? type? parameters functionAttribute* "=>" assignExpression
     | "auto"? "ref"? parameters functionAttribute* "=>" assignExpression

 gccAsmInstruction ::=
     | expression ':' gccAsmOperandList? (':' gccAsmOperandList? (':' StringLiteralList)? )? ';'
     | expression ':' ':' gccAsmOperandList? ':' StringLiteralList ';' ':' declaratorIdentifierList ';'

 gccAsmOperandList ::=
     gccAsmOperand (',' gccAsmOperand)*

 gccAsmOperand ::=
     ('[' Identifier ']')? StringLiteral '(' assignExpression ')'

 gotoStatement ::=
     "goto" (Identifier | "default" | "case" expression?) ';'

 IdentifierChain ::=
     Identifier ('.' Identifier)*

 typeIdentifierPart ::=
       IdentifierOrTemplateInstance
     | IdentifierOrTemplateInstance '.' typeIdentifierPart
     | IdentifierOrTemplateInstance '[' assignExpression ']'
     | IdentifierOrTemplateInstance '[' assignExpression ']' '.' typeIdentifierPart

 IdentifierOrTemplateChain ::=
     IdentifierOrTemplateInstance ('.' IdentifierOrTemplateInstance)*

 IdentifierOrTemplateInstance ::=
       Identifier
     | templateInstance

 identityExpression ::=
     shiftExpression ("is" | ('!' "is")) shiftExpression

 ifStatement ::=
     "if" '(' ifCondition ')' declarationOrStatement ("else" declarationOrStatement)?

 ifCondition ::=
       "auto" Identifier '=' expression
     | "scope" Identifier '=' expression
     | typeConstructors Identifier '=' expression
     | typeConstructors? type Identifier '=' expression
     | expression

 importBind ::=
     Identifier ('=' Identifier)?

 importBindings ::=
     singleImport ':' importBind (',' importBind)*

 importDeclaration ::=
       "import" singleImport (',' singleImport)* (',' importBindings)? ';'
     | "import" importBindings ';'

 importExpression ::=
     "import" '(' assignExpression ')'

 index ::=
     assignExpression (".." assignExpression)?


 indexExpression ::=
       unaryExpression '[' ']'
     | unaryExpression '[' index (',' index)* ']'


 inContractExpression ::=
     "in" '(' assertArguments ')'

 inExpression ::=
     shiftExpression ("in" | ('!' "in")) shiftExpression

 inOutContractExpression ::=
       inContractExpression
     | outContractExpression

 inOutStatement ::=
       inStatement
     | outStatement

 inStatement ::=
     "in" blockStatement

 initializer ::=
       "void"
     | nonVoidInitializer

 interfaceDeclaration ::=
       "interface" Identifier ';'
     | "interface" Identifier (':' baseClassList)? structBody
     | "interface" Identifier templateParameters constraint? (':' baseClassList)? structBody
     | "interface" Identifier templateParameters (':' baseClassList)? constraint? structBody

 invariant ::=
       "invariant" ('(' ')')? blockStatement
     | "invariant" '(' assertArguments ')' ';'

 isExpression ::=
       "is" '(' type Identifier? ')'
     | "is" '(' type Identifier? ':' typeSpecialization ')'
     | "is" '(' type Identifier? '=' typeSpecialization ')'
     | "is" '(' type Identifier? ':' typeSpecialization ',' templateParameterList ')'
     | "is" '(' type Identifier? '=' typeSpecialization ',' templateParameterList ')'

 keyValuePair ::=
     assignExpression ':' assignExpression

 keyValuePairs ::=
     keyValuePair (',' keyValuePair)* ','?

 labeledStatement ::=
     Identifier ':' declarationOrStatement?

 lastCatch ::=
     "catch" statementNoCaseNoDefault

 linkageAttribute ::=
       "extern" '(' Identifier ')'
     | "extern" '(' Identifier '-' Identifier ')'
     | "extern" '(' Identifier "++" (',' typeIdentifierPart | namespaceList | "struct" | "class")? ')'

 memberFunctionAttribute ::=
       functionAttribute
     | "immutable"
     | "inout"
     | "shared"
     | "const"
     | "return"
     | "scope"

 missingFunctionBody ::=
       ';'
     | functionContract* ';'

 mixinDeclaration ::=
       mixinExpression ';'
     | templateMixinExpression ';'

 mixinExpression ::=
     "mixin" '(' argumentList ')'

 mixinTemplateDeclaration ::=
     "mixin" templateDeclaration

 mixinTemplateName ::=
       symbol
     | typeofExpression '.' IdentifierOrTemplateChain

 module ::=
     moduleDeclaration? declaration*

 moduleDeclaration ::=
     atAttribute* deprecated? atAttribute* "module" IdentifierChain ';'

 mulExpression ::=
       powExpression
     | mulExpression ('*' | '/' | '%') powExpression

 namespaceList ::=
     ternaryExpression (',' ternaryExpression?)* ','?

 newAnonClassExpression ::=
     "new" arguments? "class" arguments? baseClassList? structBody

 newExpression ::=
       "new" type (('[' assignExpression ']') | arguments)?
     | newAnonClassExpression

 nonVoidInitializer ::=
       assignExpression
     | arrayInitializer
     | structInitializer

 operands ::=
       asmExp
     | asmExp ',' operands

 orExpression ::=
       xorExpression
     | orExpression '|' xorExpression

 orOrExpression ::=
       andAndExpression
     | orOrExpression "||" andAndExpression

 outContractExpression ::=
     "out" '(' Identifier? ';' assertArguments ')'

 outStatement ::=
     "out" ('(' Identifier ')')? blockStatement

 parameter ::=
       parameterAttribute* type
     | parameterAttribute* type Identifier? "..."
     | parameterAttribute* type Identifier? ('=' assignExpression)?

 parameterAttribute ::=
       atAttribute
     | typeConstructor
     | "final"
     | "in"
     | "lazy"
     | "out"
     | "ref"
     | "scope"
     | "auto"
     | "return"

 parameters ::=
       '(' parameter (',' parameter)* (',' variadicArgumentsAttributes? "...")? ')'
     | '(' variadicArgumentsAttributes? "..." ')'
     | '(' ')'

 variadicArgumentsAttributes ::=
       variadicArgumentsAttribute+

 variadicArgumentsAttribute ::=
       "const"
     | "immutable"
     | "scope"
     | "shared"
     | "return"

 postblit ::=
     "this" '(' "this" ')' memberFunctionAttribute* (functionBody | ';')

 powExpression ::=
       unaryExpression
     | powExpression "^^" unaryExpression

 pragmaDeclaration ::=
     pragmaExpression ';'

 pragmaExpression ::=
     "pragma" '(' Identifier (',' argumentList)? ')'

 pragmaStatement ::=
       pragmaExpression statement
     | pragmaExpression blockStatement
     | pragmaExpression ';'

 primaryExpression ::=
       IdentifierOrTemplateInstance
     | '.' IdentifierOrTemplateInstance
     | typeConstructor '(' basicType ')' '.' Identifier
     | basicType '.' Identifier
     | basicType arguments
     | typeofExpression
     | typeidExpression
     | vector
     | arrayLiteral
     | assocArrayLiteral
     | '(' expression ')'
     | isExpression
     | functionLiteralExpression
     | traitsExpression
     | mixinExpression
     | importExpression
     | '$'
     | "this"
     | "super"
     | "null"
     | "true"
     | "false"
     | "__DATE__"
     | "__FILE__"
     | "__FILE_FULL_PATH__"
     | "__FUNCTION__"
     | "__LINE__"
     | "__MODULE__"
     | "__PRETTY_FUNCTION__"
     | "__TIME__"
     | "__TIMESTAMP__"
     | "__VENDOR__"
     | "__VERSION__"
     | IntegerLiteral
     | FloatLiteral
     | StringLiteral+
     | CharacterLiteral

 register ::=
       Identifier
     | Identifier '(' IntegerLiteral ')'

 relExpression ::=
       shiftExpression
     | relExpression relOperator shiftExpression

 relOperator ::=
       '<'
     | "<="
     | '>'
     | ">="
     | "!<>="
     | "!<>"
     | "<>"
     | "<>="
     | "!>"
     | "!>="
     | "!<"
     | "!<="

 returnStatement ::=
     "return" expression? ';'

 scopeGuardStatement ::=
     "scope" '(' Identifier ')' declarationOrStatement

 sharedStaticConstructor ::=
     "shared" "static" "this" '(' ')' memberFunctionAttribute* (functionBody | ';')

 sharedStaticDestructor ::=
     "shared" "static" '~' "this" '(' ')' memberFunctionAttribute* (functionBody | ';')

 shiftExpression ::=
       addExpression
     | shiftExpression ("<<" | ">>" | ">>>") addExpression

 singleImport ::=
     (Identifier '=')? IdentifierChain

 shortenedFunctionBody ::=
      inOutContractExpression* "=>" expression ';'

 specifiedFunctionBody ::=
       "do"? blockStatement
     | functionContract* inOutContractExpression "do"? blockStatement
     | functionContract* inOutStatement "do" blockStatement

 statement ::=
       statementNoCaseNoDefault
     | caseStatement
     | caseRangeStatement
     | defaultStatement

 statementNoCaseNoDefault ::=
       labeledStatement
     | blockStatement
     | ifStatement
     | whileStatement
     | doStatement
     | forStatement
     | foreachStatement
     | switchStatement
     | finalSwitchStatement
     | continueStatement
     | breakStatement
     | returnStatement
     | gotoStatement
     | withStatement
     | synchronizedStatement
     | tryStatement
     | scopeGuardStatement
     | pragmaStatement
     | asmStatement
     | conditionalStatement
     | staticAssertStatement
     | versionSpecification
     | debugSpecification
     | expressionStatement

 staticAssertDeclaration ::=
     staticAssertStatement

 staticAssertStatement ::=
     "static" assertExpression ';'

 staticConstructor ::=
     "static" "this" '(' ')' memberFunctionAttribute* (functionBody | ';')

 staticDestructor ::=
     "static" '~' "this" '(' ')' memberFunctionAttribute* (functionBody | ';')

 staticIfCondition ::=
     "static" "if" '(' assignExpression ')'

 storageClass ::=
       alignAttribute
     | linkageAttribute
     | atAttribute
     | typeConstructor
     | deprecated
     | "abstract"
     | "auto"
     | "enum"
     | "extern"
     | "final"
     | "nothrow"
     | "override"
     | "pure"
     | "ref"
     | "__gshared"
     | "scope"
     | "static"
     | "synchronized"
     | "throw"

 structBody ::=
     '{' declaration* '}'

 structDeclaration ::=
       "struct" Identifier (templateParameters constraint?)? (structBody | ';')
     | "struct" structBody

 structInitializer ::=
     '{' structMemberInitializers? '}'

 structMemberInitializer ::=
     (Identifier ':')? nonVoidInitializer

 structMemberInitializers ::=
     structMemberInitializer (',' structMemberInitializer?)*

 switchStatement ::=
     "switch" '(' expression ')' statement

 symbol ::=
     '.'? IdentifierOrTemplateChain

 synchronizedStatement ::=
     "synchronized" ('(' expression ')')? statementNoCaseNoDefault

 templateAliasParameter ::=
     "alias" type? Identifier (':' (type | assignExpression))? ('=' (type | assignExpression))?

 namedTemplateArgument ::=
       (Identifier ':')? type
     | (Identifier ':')? assignExpression

 templateArgument ::=
       type
     | assignExpression

 templateArgumentList ::=
     templateArgument (',' templateArgument?)*

 namedTemplateArgumentList ::=
     namedTemplateArgument (',' namedTemplateArgument?)*

 templateArguments ::=
     '!' ('(' namedTemplateArgumentList? ')') | templateSingleArgument

 templateDeclaration ::=
       "template" Identifier templateParameters constraint? '{' declaration* '}'

 templateInstance ::=
     Identifier templateArguments

 templateMixinExpression ::=
     "mixin" mixinTemplateName templateArguments? Identifier?

 templateParameter ::=
       templateTypeParameter
     | templateValueParameter
     | templateAliasParameter
     | templateTupleParameter
     | templateThisParameter

 templateParameterList ::=
     templateParameter (',' templateParameter?)* ','?

 templateParameters ::=
     '(' templateParameterList? ')'

 templateSingleArgument ::=
       builtinType
     | Identifier
     | CharacterLiteral
     | StringLiteral
     | IntegerLiteral
     | FloatLiteral
     | "true"
     | "false"
     | "null"
     | "this"
     | "__DATE__"
     | "__FILE__"
     | "__FILE_FULL_PATH__"
     | "__FUNCTION__"
     | "__LINE__"
     | "__MODULE__"
     | "__PRETTY_FUNCTION__"
     | "__TIME__"
     | "__TIMESTAMP__"
     | "__VENDOR__"
     | "__VERSION__"

 templateThisParameter ::=
     "this" templateTypeParameter

 templateTupleParameter ::=
     Identifier "..."

 templateTypeParameter ::=
     Identifier (':' type)? ('=' type)?

 templateValueParameter ::=
     type Identifier (':' assignExpression)? templateValueParameterDefault?

 templateValueParameterDefault ::=
       '=' "__DATE__"
     | '=' "__FILE__"
     | '=' "__FILE_FULL_PATH__"
     | '=' "__FUNCTION__"
     | '=' "__LINE__"
     | '=' "__MODULE__"
     | '=' "__PRETTY_FUNCTION__"
     | '=' "__TIME__"
     | '=' "__TIMESTAMP__"
     | '=' "__VENDOR__"
     | '=' "__VERSION__"
     | '=' assignExpression

 ternaryExpression ::=
     orOrExpression ('?' expression ':' ternaryExpression)?

 throwExpression ::=
     "throw" assignExpression

 traitsExpression ::=
     "__traits" '(' Identifier ',' templateArgumentList ')'

 tryStatement ::=
     "try" declarationOrStatement (catches | catches finally | finally)

 type ::=
     typeConstructors? type2 typeSuffix*

 type2 ::=
       builtinType
     | typeIdentifierPart
     | "super" '.' typeIdentifierPart
     | "this" '.' typeIdentifierPart
     | typeofExpression ('.' typeIdentifierPart)?
     | typeConstructor '(' type ')'
     | traitsExpression
     | vector
     | mixinExpression

 typeConstructor ::=
       "const"
     | "immutable"
     | "inout"
     | "shared"

 typeConstructors ::=
     typeConstructor+

 typeSpecialization ::=
       type
     | "struct"
     | "union"
     | "class"
     | "interface"
     | "enum"
     | "_vector"
     | "function"
     | "delegate"
     | "super"
     | "const"
     | "immutable"
     | "inout"
     | "shared"
     | "return"
     | "_parameters"
     | "module"
     | "package"

 typeSuffix ::=
       '*'
     | '[' type? ']'
     | '[' assignExpression ']'
     | '[' assignExpression ".."  assignExpression ']'
     | ("delegate" | "function") parameters memberFunctionAttribute*

 typeidExpression ::=
     "typeid" '(' (type | expression) ')'

 typeofExpression ::=
     "typeof" '(' (expression | "return") ')'

 unaryExpression ::=
       primaryExpression
     | '&' unaryExpression
     | '!' unaryExpression
     | '*' unaryExpression
     | '+' unaryExpression
     | '-' unaryExpression
     | '~' unaryExpression
     | "++" unaryExpression
     | "--" unaryExpression
     | newExpression
     | deleteExpression
     | castExpression
     | assertExpression
     | throwExpression
     | functionCallExpression
     | indexExpression
     | '(' type ')' '.' IdentifierOrTemplateInstance
     | unaryExpression '.' newExpression
     | unaryExpression '.' IdentifierOrTemplateInstance
     | unaryExpression "--"
     | unaryExpression "++"

 unionDeclaration ::=
       "union" Identifier (templateParameters constraint?)? (structBody | ';')
     | "union" structBody

 unittest ::=
     "unittest" blockStatement

 variableDeclaration ::=
       storageClass* type declarator (',' declarator)* ';'
     | autoDeclaration

 vector ::=
     "__vector" ('(' type ')')?

 versionCondition ::=
     "version" '(' (IntegerLiteral | Identifier | "unittest" | "assert") ')'

 versionSpecification ::=
     "version" '=' (Identifier | IntegerLiteral) ';'

 whileStatement ::=
     "while" '(' ifCondition ')' declarationOrStatement

 withStatement ::=
     "with" '(' expression ')' declarationOrStatement

 xorExpression ::=
       andExpression
     | xorExpression '^' andExpression
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant