Grammar connected by Vadim Zaytsev, see the Grammar Zoo entry for details: dart/latex/v45.0/connected
Source used for this grammar: Gilad Bracha, Dart Programming Language Specification, Version 1.6, dartLangSpec.tex
, 2014-10-13T17:12:08Z [Explore]
variableDeclaration
, declaredIdentifier
, finalConstVarOrType
, varOrType
, initializedVariableDeclaration
, initializedIdentifier
, initializedIdentifierList
, functionSignature
, returnType
, functionBody
, block
, formalParameterList
, normalFormalParameters
, optionalFormalParameters
, optionalPositionalFormalParameters
, namedFormalParameters
, normalFormalParameter
, simpleFormalParameter
, fieldFormalParameter
, defaultFormalParameter
, defaultNamedParameter
, classDefinition
, mixins
, classMemberDefinition
, methodSignature
, declaration
, staticFinalDeclarationList
, staticFinalDeclaration
, operatorSignature
, operator
, binaryOperator
, getterSignature
, setterSignature
, constructorSignature
, redirection
, initializers
, superCallOrFieldInitializer
, fieldInitializer
, factoryConstructorSignature
, redirectingFactoryConstructorSignature
, constantConstructorSignature
, superclass
, interfaces
, mixinApplicationClass
, mixinApplication
, enumType
, typeParameter
, typeParameters
, metadata
, expression
, expressionWithoutCascade
, expressionList
, primary
, literal
, nullLiteral
, numericLiteral
, NUMBER
, EXPONENT
, HEX_NUMBER
, HEX_DIGIT
, booleanLiteral
, stringLiteral
, singleLineString
, multilineString
, ESCAPE_SEQUENCE
, HEX_DIGIT_SEQUENCE
, stringContentDQ
, stringContentSQ
, stringContentTDQ
, stringContentTSQ
, NEWLINE
, stringInterpolation
, symbolLiteral
, listLiteral
, mapLiteral
, mapLiteralEntry
, throwExpression
, throwExpressionWithoutCascade
, functionExpression
, thisExpression
, newExpression
, constObjectExpression
, arguments
, argumentList
, namedArgument
, cascadeSection
, cascadeSelector
, assignmentOperator
, compoundAssignmentOperator
, conditionalExpression
, logicalOrExpression
, logicalAndExpression
, equalityExpression
, equalityOperator
, relationalExpression
, relationalOperator
, bitwiseOrExpression
, bitwiseXorExpression
, bitwiseAndExpression
, bitwiseOperator
, shiftExpression
, shiftOperator
, additiveExpression
, additiveOperator
, multiplicativeExpression
, multiplicativeOperator
, unaryExpression
, prefixOperator
, minusOperator
, negationOperator
, tildeOperator
, awaitExpression
, postfixExpression
, postfixOperator
, selector
, incrementOperator
, assignableExpression
, assignableSelector
, identifier
, IDENTIFIER_NO_DOLLAR
, IDENTIFIER
, BUILT_IN_IDENTIFIER
, IDENTIFIER_START
, IDENTIFIER_START_NO_DOLLAR
, IDENTIFIER_PART_NO_DOLLAR
, IDENTIFIER_PART
, qualified
, typeTest
, isOperator
, typeCast
, asOperator
, statements
, statement
, nonLabelledStatement
, expressionStatement
, localVariableDeclaration
, localFunctionDeclaration
, ifStatement
, forStatement
, forLoopParts
, forInitializerStatement
, whileStatement
, doStatement
, switchStatement
, switchCase
, defaultCase
, rethrowStatement
, tryStatement
, onPart
, catchPart
, finallyPart
, returnStatement
, label
, breakStatement
, continueStatement
, yieldStatement
, yieldEachStatement
, assertStatement
, topLevelDefinition
, libraryDefinition
, scriptTag
, libraryName
, importOrExport
, libraryImport
, importSpecification
, combinator
, identifierList
, libraryExport
, partDirective
, partHeader
, partDeclaration
, uri
, type
, typeName
, typeArguments
, typeList
, typeAlias
, typeAliasBody
, functionTypeAlias
, functionPrefix
, LETTER
, DIGIT
, WHITESPACE
, SINGLE_LINE_COMMENT
, MULTI_LINE_COMMENT
, compilationUnit
), 1 root (compilationUnit
), 4 top (ESCAPE_SEQUENCE
, BUILT_IN_IDENTIFIER
, WHITESPACE
, SINGLE_LINE_COMMENT
), 1 bottom (EOF
).variableDeclaration ::= declaredIdentifier "," identifier
declaredIdentifier ::= metadata finalConstVarOrType identifier
finalConstVarOrType ::= "final" type "const" type varOrType
varOrType ::=
"var"
type
initializedVariableDeclaration ::= declaredIdentifier "=" expression "," initializedIdentifier
initializedIdentifier ::= identifier "=" expression
initializedIdentifierList ::= initializedIdentifier "," initializedIdentifier
functionSignature ::=
metadata returnType
identifier formalParameterListreturnType ::=
"void"
type
functionBody ::= "async" "=>" expression ";" "async""async""sync" block
block ::= "{" statements "}"
formalParameterList ::= "(" ")" "(" normalFormalParameters "," optionalFormalParameters ")" "(" optionalFormalParameters ")"
normalFormalParameters ::= normalFormalParameter "," normalFormalParameter
optionalFormalParameters ::= optionalPositionalFormalParameters namedFormalParameters
optionalPositionalFormalParameters ::= "[" defaultFormalParameter "," defaultFormalParameter "]"
namedFormalParameters ::= "{" defaultNamedParameter "," defaultNamedParameter "}"
normalFormalParameter ::= functionSignature fieldFormalParameter simpleFormalParameter
simpleFormalParameter ::= declaredIdentifier metadata identifier
fieldFormalParameter ::= metadata finalConstVarOrType"this" "." identifier formalParameterList
defaultFormalParameter ::= normalFormalParameter "=" expression
defaultNamedParameter ::= normalFormalParameter ":" expression
classDefinition ::= metadata "abstract" "class" identifier typeParameters superclass mixins interfaces "{" metadata classMemberDefinition "}" metadata "abstract" "class" mixinApplicationClass
mixins ::=
"with" typeList
classMemberDefinition ::=
declaration ";"
methodSignature functionBody
methodSignature ::= constructorSignature initializers"static" functionSignature "static" getterSignature "static" setterSignature operatorSignaturefactoryConstructorSignature
methodSignature ::= redirectingFactoryConstructorSignature
declaration ::= constantConstructorSignature "external" constantConstructorSignature "external" constructorSignature "external" "static" getterSignature "external" "static" setterSignature "external" operatorSignature "external" "static" functionSignature "static" "final""const" type staticFinalDeclarationList "final" type initializedIdentifierList "static" "var" type initializedIdentifierListredirection initializers constructorSignature redirection initializers
staticFinalDeclarationList ::= staticFinalDeclaration "," staticFinalDeclaration
staticFinalDeclaration ::=
identifier "=" expression
operatorSignature ::= returnType"operator" operator formalParameterList
operator ::= "~" binaryOperator "[" "]" "[" "]" "="
binaryOperator ::=
multiplicativeOperator
additiveOperator
shiftOperator
relationalOperator
"=="
bitwiseOperator
getterSignature ::= returnType"get" identifier
setterSignature ::= returnType"set" identifier formalParameterList
constructorSignature ::= identifier "." identifier formalParameterList
redirection ::= ":" "this" "." identifier arguments
initializers ::= ":" superCallOrFieldInitializer "," superCallOrFieldInitializer
superCallOrFieldInitializer ::= "super" arguments "super" "." identifier arguments fieldInitializer
fieldInitializer ::= "this" "." identifier "=" conditionalExpression cascadeSection
factoryConstructorSignature ::= "factory" identifier "." identifier formalParameterList
redirectingFactoryConstructorSignature ::= "const" "factory" identifier "." identifier formalParameterList "=" type "." identifier
constantConstructorSignature ::=
"const" qualified formalParameterList
superclass ::=
"extends" type
interfaces ::=
"implements" typeList
mixinApplicationClass ::= identifier typeParameters"=" mixinApplication ";"
mixinApplication ::=
type mixins interfaces
enumType ::= metadata "enum" identifier "{" identifier "," identifier "," "}"
typeParameter ::= metadata identifier "extends" type
typeParameters ::= "<" typeParameter "," typeParameter ">"
metadata ::= "@" qualified "." identifier arguments
expression ::=
assignableExpression assignmentOperator expression
conditionalExpression cascadeSection
throwExpressionexpressionWithoutCascade ::= assignableExpression assignmentOperator expressionWithoutCascade conditionalExpression throwExpressionWithoutCascade
expressionList ::= expression "," expression
primary ::= thisExpression "super" assignableSelector functionExpression literal identifier newExpression constObjectExpression "(" expression ")"
literal ::= nullLiteral booleanLiteral numericLiteral stringLiteral symbolLiteral mapLiteral listLiteral
nullLiteral ::=
"null"
numericLiteral ::= NUMBER HEX_NUMBER
NUMBER ::= DIGIT"." DIGIT EXPONENT "." DIGIT EXPONENT
EXPONENT ::= "e""E" "+""-" DIGIT
HEX_NUMBER ::= "0x" HEX_DIGIT "0X" HEX_DIGIT
HEX_DIGIT ::= "a" "b" "c" "d" "e" "f" "A" "B" "C" "D" "E" "F" DIGIT
booleanLiteral ::= "true" "false"
stringLiteral ::=multilineString singleLineString
singleLineString ::= """ stringContentDQ """ """ stringContentSQ """ "r" """ """ NEWLINE """
multilineString ::= """"" stringContentTDQ """"" """"" stringContentTSQ """"" "r" """"" """"" """""
ESCAPE_SEQUENCE ::= "\n" "\r" "\f" "\b" "\t" "\v" "\x" HEX_DIGIT HEX_DIGIT "\u" HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT "\u{" HEX_DIGIT_SEQUENCE "}"
HEX_DIGIT_SEQUENCE ::= HEX_DIGIT HEX_DIGITHEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT
stringContentDQ ::= "\"""""$" NEWLINE "\" NEWLINE stringInterpolation
stringContentSQ ::= "\"""""$" NEWLINE "\" NEWLINE stringInterpolation
stringContentTDQ ::= "\"""""""$" stringInterpolation
stringContentTSQ ::= "\"""""""$" stringInterpolation
NEWLINE ::= "\n" "\r"
stringInterpolation ::= "$" IDENTIFIER_NO_DOLLAR "$" "{" expression "}"
symbolLiteral ::= "#" operator identifier "." identifier
listLiteral ::= "const" typeArguments "[" expressionList "," "]"
mapLiteral ::= "const" typeArguments "{" mapLiteralEntry "," mapLiteralEntry "," "}"
mapLiteralEntry ::=
expression ":" expression
throwExpression ::=
"throw" expression
throwExpressionWithoutCascade ::=
"throw" expressionWithoutCascade
functionExpression ::= formalParameterList functionBody
thisExpression ::=
"this"
newExpression ::= "new" type "." identifier arguments
constObjectExpression ::= "const" type "." identifier arguments
arguments ::= "(" argumentList ")"
argumentList ::= namedArgument "," namedArgument expressionList "," namedArgument
namedArgument ::= label expression
cascadeSection ::= ".." cascadeSelector arguments assignableSelector arguments assignmentOperator expressionWithoutCascade
cascadeSelector ::= "[" expression "]" identifier
assignmentOperator ::=
"="
compoundAssignmentOperator
compoundAssignmentOperator ::= "*=" "/=" "~/=" "%=" "+=" "-=" "<<=" ">>=" "&=" "^=" "|="
conditionalExpression ::= logicalOrExpression "?" expressionWithoutCascade ":" expressionWithoutCascade
logicalOrExpression ::= logicalAndExpression "||" logicalAndExpression
logicalAndExpression ::= equalityExpression "&&" equalityExpression
equalityExpression ::= relationalExpression "super" equalityOperator relationalExpressionequalityOperator relationalExpression
equalityOperator ::= "==" "!="
relationalExpression ::= bitwiseOrExpression "super" relationalOperator bitwiseOrExpressiontypeTest typeCast relationalOperator bitwiseOrExpression
relationalOperator ::= ">=" ">" "<=" "<"
bitwiseOrExpression ::= bitwiseXorExpression "|" bitwiseXorExpression "super" "|" bitwiseXorExpression
bitwiseXorExpression ::= bitwiseAndExpression "^" bitwiseAndExpression "super" "^" bitwiseAndExpression
bitwiseAndExpression ::= shiftExpression "&" shiftExpression "super" "&" shiftExpression
bitwiseOperator ::= "&" "^" "|"
shiftExpression ::= additiveExpression "super" shiftOperator additiveExpressionshiftOperator additiveExpression
shiftOperator ::= "<<" ">>"
additiveExpression ::= multiplicativeExpression "super" additiveOperator multiplicativeExpressionadditiveOperator multiplicativeExpression
additiveOperator ::= "+" "-"
multiplicativeExpression ::= unaryExpression "super" multiplicativeOperator unaryExpressionmultiplicativeOperator unaryExpression
multiplicativeOperator ::= "*" "/" "%" "~/"
unaryExpression ::= prefixOperator unaryExpression awaitExpression postfixExpression "super" incrementOperator assignableExpressionminusOperator tildeOperator
prefixOperator ::= minusOperator negationOperator tildeOperator
minusOperator ::=
"-"
ε
negationOperator ::=
"!"
ε
tildeOperator ::=
"~"
awaitExpression ::=
"await" unaryExpression
postfixExpression ::=
assignableExpression postfixOperator
primary selector
postfixOperator ::= incrementOperator
selector ::= assignableSelector arguments
incrementOperator ::= "++" "--"
assignableExpression ::= primary "super" assignableSelector identifiernamedArgument assignableSelector
assignableSelector ::= "[" expression "]" "." identifier
identifier ::= IDENTIFIER
IDENTIFIER_NO_DOLLAR ::=
IDENTIFIER_START_NO_DOLLAR IDENTIFIER_PART_NO_DOLLAR
IDENTIFIER ::=
IDENTIFIER_START IDENTIFIER_PART
BUILT_IN_IDENTIFIER ::= "abstract" "as" "deferred" "dynamic" "export" "external" "factory" "get" "implements" "import" "library" "operator" "part" "set" "static" "typedef"
IDENTIFIER_START ::=
IDENTIFIER_START_NO_DOLLAR
"$"
IDENTIFIER_START_NO_DOLLAR ::=
LETTER
"_"
IDENTIFIER_PART_NO_DOLLAR ::= IDENTIFIER_START_NO_DOLLAR DIGIT
IDENTIFIER_PART ::= IDENTIFIER_START DIGIT
qualified ::= identifier "." identifier
typeTest ::= isOperator type
isOperator ::= "is" "!"
typeCast ::= asOperator type
asOperator ::=
"as"
statements ::=
statement
statement ::=
label
nonLabelledStatementnonLabelledStatement ::= block localVariableDeclaration forStatement whileStatement doStatement switchStatement ifStatement rethrowStatement tryStatement breakStatement continueStatement returnStatement yieldStatement yieldEachStatement expressionStatement assertStatement localFunctionDeclaration
expressionStatement ::= expression";"
localVariableDeclaration ::=
initializedVariableDeclaration ";"
localFunctionDeclaration ::= functionSignature functionBody
ifStatement ::= "if" "(" expression ")" statement "else" statement
forStatement ::= "await" "for" "(" forLoopParts ")" statement
forLoopParts ::= forInitializerStatement expression";" expressionList declaredIdentifier "in" expression identifier "in" expression
forInitializerStatement ::= localVariableDeclaration ";" expression ";"
whileStatement ::= "while" "(" expression ")" statement
doStatement ::= "do" statement "while" "(" expression ")" ";"
switchStatement ::= "switch" "(" expression ")" "{" switchCase defaultCase "}"
switchCase ::= label"case" expression ":" statements
defaultCase ::= label"default" ":" statements
rethrowStatement ::= "rethrow" ";"
tryStatement ::= "try" block onPart finallyPart finallyPart
onPart ::= catchPart block "on" type catchPart block
catchPart ::= "catch" "(" identifier "," identifier ")"
finallyPart ::=
"finally" block
returnStatement ::= "return" expression ";"
label ::=
identifier ":"
breakStatement ::= "break" identifier ";"
continueStatement ::= "continue" identifier ";"
yieldStatement ::= "yield" expression ";"
yieldEachStatement ::= "yield" expression ";"
assertStatement ::= "assert" "(" conditionalExpression ")" ";"
topLevelDefinition ::= classDefinition enumType typeAlias "external" functionSignature ";" "external" getterSignature ";" "external" setterSignature ";" functionSignature functionBody returnType "get" identifier functionBody returnType "set" identifier formalParameterList functionBody "final""const" type staticFinalDeclarationList ";" variableDeclaration ";"
libraryDefinition ::= scriptTaglibraryName importOrExport partDirective topLevelDefinition
scriptTag ::= "#!" NEWLINE NEWLINE
libraryName ::= metadata "library" identifier "." identifier ";"
importOrExport ::= libraryImport libraryExport
libraryImport ::= metadata importSpecification
importSpecification ::= "import" uri "as" identifier combinator ";" "import" uri "deferred" "as" identifier combinator ";"
combinator ::= "show" identifierList "hide" identifierList
identifierList ::= identifier "," identifier
libraryExport ::= metadata "export" uri combinator ";"
partDirective ::= metadata "part" uri ";"
partHeader ::= metadata "part" "of" identifier "." identifier ";"
partDeclaration ::=
partHeader topLevelDefinition
EOFuri ::= stringLiteral
type ::=
typeName typeArguments
typeName ::= qualified
typeArguments ::= "<" typeList ">"
typeList ::= type "," type
typeAlias ::=
metadata "typedef" typeAliasBody
typeAliasBody ::= functionTypeAlias
functionTypeAlias ::= functionPrefix typeParameters";"formalParameterList
functionPrefix ::=
returnType
identifierLETTER ::= "a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" "m" "n" "o" "p" "q" "r" "s" "t" "u" "v" "w" "x" "y" "z" "A" "B" "C" "D" "E" "F" "G" "H" "I" "J" "K" "L" "M" "N" "O" "P" "Q" "R" "S" "T" "U" "V" "W" "X" "Y" "Z"
DIGIT ::= "0" "1" "2" "3" "4" "5" "6" "7" "8" "9"
WHITESPACE ::= "\t"" " NEWLINE
SINGLE_LINE_COMMENT ::= "//" NEWLINE
MULTI_LINE_COMMENT ::= "/*" MULTI_LINE_COMMENT"*/" "*/"
compilationUnit ::= libraryDefinition partDeclaration