12. Visual Basic .NET Grammar Summary
This section summarizes the Visual Basic language grammar. For information on how to read the grammar, see 1.1 Grammar Notation.
Start ::= [ LogicalLine+ ]
LogicalLine ::= [ LogicalLineElement+ ] [ Comment ] LineTerminator
LogicalLineElement ::= WhiteSpace | LineContinuation | Token
Token ::= Identifier | Keyword | Literal | Separator | Operator
Character ::= < any Unicode character except a LineTerminator >
LineTerminator ::=
< Unicode carriage return character (0x000D) > |
< Unicode linefeed character (0x000A) > |
< Unicode carriage return character > < Unicode linefeed character > |
< Unicode line separator character (0x2028) > |
< Unicode paragraph separator character (0x2029) >
LineContinuation ::= WhiteSpace _ [ WhiteSpace+ ] LineTerminator
WhiteSpace ::=
< Unicode blank characters (class Zs) > |
< Unicode tab character (0x0009) >
Comment ::= CommentMarker [ Character+ ]
CommentMarker ::= SingleQuoteCharacter | REM
SingleQuoteCharacter ::=
' |
< Unicode left single-quote character (0x2018) |
< Unicode right single-quote character (0x2019)
Identifier ::=
NonEscapedIdentifier [ TypeCharacter ] |
EscapedIdentifier
NonEscapedIdentifier ::= < IdentifierName but not Keyword >
EscapedIdentifier ::= [ IdentifierName ]
IdentifierName ::= IdentifierStart [ IdentifierCharacter+ ]
IdentifierStart ::=
AlphaCharacter |
UnderscoreCharacter IdentifierCharacter
IdentifierCharacter ::=
UnderscoreCharacter |
AlphaCharacter |
NumericCharacter |
CombiningCharacter |
FormattingCharacter
AlphaCharacter ::=
< Unicode alphabetic character (classes Lu, Ll, Lt, Lm, Lo, Nl) >
NumericCharacter ::= < Unicode decimal digit character (class Nd) >
CombiningCharacter ::= < Unicode combining character (classes Mn, Mc) >
FormattingCharacter ::= < Unicode formatting character (class Cf) >
UnderscoreCharacter ::= < Unicode connection character (class Pc) >
IdentifierOrKeyword ::= Identifier | Keyword
TypeCharacter ::=
IntegerTypeCharacter |
LongTypeCharacter |
DecimalTypeCharacter |
SingleTypeCharacter |
DoubleTypeCharacter |
StringTypeCharacter
IntegerTypeCharacter ::= %
LongTypeCharacter ::= &
DecimalTypeCharacter ::= @
SingleTypeCharacter ::= !
DoubleTypeCharacter ::= #
StringTypeCharacter ::= $
Keyword ::= < member of keyword table at 2.3 Keywords >
Literal ::=
BooleanLiteral |
IntegerLiteral |
FloatingPointLiteral |
StringLiteral |
CharacterLiteral |
DateLiteral |
Nothing
BooleanLiteral ::= True | False
IntegerLiteral ::= IntegralLiteralValue [ IntegralTypeCharacter ]
IntegralLiteralValue ::= IntLiteral | HexLiteral | OctalLiteral
IntegralTypeCharacter ::=
ShortCharacter |
IntegerCharacter |
LongCharacter |
IntegerTypeCharacter |
LongTypeCharacter
ShortCharacter ::= S
IntegerCharacter ::= I
LongCharacter ::= L
IntLiteral ::= Digit+
HexLiteral ::= & H HexDigit+
OctalLiteral ::= & O OctalDigit+
Digit ::= 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
HexDigit ::=
0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F
OctalDigit ::= 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7
FloatingPointLiteral ::=
FloatingPointLiteralValue [ FloatingPointTypeCharacter ] |
IntLiteral FloatingPointTypeCharacter
FloatingPointTypeCharacter ::=
SingleCharacter |
DoubleCharacter |
DecimalCharacter |
SingleTypeCharacter |
DoubleTypeCharacter |
DecimalTypeCharacter
SingleCharacter ::= F
DoubleCharacter ::= R
DecimalCharacter ::= D
FloatingPointLiteralValue ::=
IntLiteral . IntLiteral [ Exponent ] |
. IntLiteral [ Exponent ] |
IntLiteral Exponent
Exponent ::= E [ Sign ] IntLiteral
Sign ::= + | -
StringLiteral ::=
DoubleQuoteCharacter [ StringCharacter+ ] DoubleQuoteCharacter
DoubleQuoteCharacter ::=
" |
< Unicode left double-quote character (0x201C) > |
< Unicode right double-quote character (0x201D) >
StringCharacter ::=
< Character except for DoubleQuoteCharacter > |
DoubleQuoteCharacter DoubleQuoteCharacter
CharacterLiteral ::=
DoubleQuoteCharacter StringCharacter DoubleQuoteCharacter C
DateLiteral ::= # [ Whitespace+ ] DateOrTime [ Whitespace+ ] #
DateOrTime ::=
DateValue Whitespace+ TimeValue |
DateValue |
TimeValue
DateValue ::=
MonthValue / DayValue / YearValue |
MonthValue – DayValue - YearValue
TimeValue ::=
HourValue : MinuteValue [ : SecondValue ] [ WhiteSpace+ ] [ AMPM ]
MonthValue ::= IntLiteral
DayValue ::= IntLiteral
YearValue ::= IntLiteral
HourValue ::= IntLiteral
MinuteValue ::= IntLiteral
SecondValue ::= IntLiteral
AMPM ::= AM | PM
Separator ::= ( | ) | { | } | ! | # | , | . | :
Operator ::= & | * | + | - | / | \ | ^ | < | = | >
Start ::= [ ConditionalElement+ ]
ConditionalElement ::=
ConditionalConstantDeclaration |
ConditionalIfGroup |
LogicalLine
ConditionalConstantDeclaration ::=
# Const Identifier = ConstantExpression LineTerminator
ConditionalIfGroup ::=
# If ConstantExpression [ Then ] LineTerminator
[ ConditionalElement+ ]
[ ConditionalElseIfGroup+ ]
[ ConditionalElseGroup ]
# End If LineTerminator
ConditionalElseIfGroup ::=
# ElseIf ConstantExpression [ Then ] LineTerminator
[ ConditionalElement+ ]
ConditionalElseGroup ::=
# Else LineTerminator
[ ConditionalElement+ ]
Start ::= [ ExternalSourceElement+ ]
ExternalSourceElement ::= ExternalSourceGroup | LogicalLine
ExternalSourceGroup ::=
# ExternalSource ( StringLiteral , IntLiteral ) LineTerminator
[ LogicalLine+ ]
# End ExternalSource LineTerminator
Start ::= [ RegionElement+ ]
RegionElement ::= RegionGroup | LogicalLine
RegionGroup ::=
# Region StringLiteral LineTerminator
[ LogicalLine+ ]
# End Region LineTerminator
AccessModifier ::= Public | Protected | Friend | Private
QualifiedIdentifier ::=
Identifier |
QualifiedIdentifier . IdentifierOrKeyword
NamespaceOrTypeName ::= QualifiedIdentifier
Attributes ::= < AttributeList >
AttributeList ::=
Attribute |
AttributeList , Attribute
Attribute ::=
[ AttributeModifier : ] TypeName [ ( [ AttributeArguments ] ) ]
AttributeModifier ::= Assembly | Module
AttributeArguments ::=
AttributePositionalArgumentList |
AttributePositionalArgumentList , VariablePropertyInitializerList |
VariablePropertyInitializerList
AttributePositionalArgumentList ::=
ConstantExpression |
AttributePositionalArgumentList , ConstantExpression
VariablePropertyInitializerList ::=
VariablePropertyInitializer |
VariablePropertyInitializerList , VariablePropertyInitializer
VariablePropertyInitializer ::=
IdentifierOrKeyword : = ConstantExpression
Start ::=
[ OptionStatement+ ]
[ ImportsStatement+ ]
[ Attributes ]
[ NamespaceMemberDeclaration+ ]
OptionStatement ::=
OptionExplicitStatement |
OptionStrictStatement |
OptionCompareStatement
OptionExplicitStatement ::= Option Explicit [ OnOff ] LineTerminator
OnOff ::= On | Off
OptionStrictStatement ::= Option Strict [ OnOff ] LineTerminator
OptionCompareStatement ::= Option Compare CompareOption LineTerminator
CompareOption ::= Binary | Text
ImportsStatement ::= Imports ImportsClauses LineTerminator
ImportsClauses ::=
ImportsClause |
ImportsClauses , ImportsClause
ImportsClause ::= ImportsAliasClause | ImportsNamespaceClause
ImportsAliasClause ::= Identifier = NamespaceOrTypeName
ImportsNamespaceClause ::= NamespaceOrTypeName
NamespaceDeclaration ::=
Namespace QualifiedIdentifier LineTerminator
[ NamespaceMemberDeclaration+ ]
End Namespace LineTerminator
NamespaceMemberDeclaration ::=
NamespaceDeclaration |
TypeDeclaration
TypeDeclaration ::=
ModuleDeclaration |
NonModuleDeclaration
NonModuleDeclaration ::=
EnumDeclaration |
StructureDeclaration |
InterfaceDeclaration |
ClassDeclaration |
DelegateDeclaration
TypeName ::=
NamespaceOrTypeName |
BuiltInTypeName |
ArrayTypeName
BuiltInTypeName ::= Object | PrimitiveTypeName
TypeImplementsClause ::= Implements Implements LineTerminator
Implements ::=
TypeName |
Implements , TypeName
PrimitiveTypeName ::= NumericTypeName | Boolean | Date | Char | String
NumericTypeName ::= IntegralTypeName | FloatingPointTypeName | Decimal
IntegralTypeName ::= Byte | Short | Integer | Long
FloatingPointTypeName ::= Single | Double
EnumDeclaration ::=
[ Attributes ] [ EnumModifier+ ] Enum Identifier
[ As IntegralTypeName ] LineTerminator
EnumMemberDeclaration+
End Enum LineTerminator
EnumModifier ::= AccessModifier | Shadows
EnumMemberDeclaration ::=
[ Attributes ] Identifier [ = ConstantExpression ] LineTerminator
ClassDeclaration ::=
[ Attributes ] [ ClassModifier+ ] Class Identifier LineTerminator
[ ClassBase ]
[ TypeImplementsClause+ ]
[ ClassMemberDeclaration+ ]
End Class LineTerminator
ClassModifier ::= AccessModifier | Shadows | MustInherit | NotInheritable
ClassBase ::= Inherits TypeName LineTerminator
ClassMemberDeclaration ::=
NonModuleDeclaration |
EventMemberDeclaration |
VariableMemberDeclaration |
ConstantMemberDeclaration |
MethodMemberDeclaration |
PropertyMemberDeclaration |
ConstructorMemberDeclaration
StructureDeclaration ::=
[ Attributes ] [ StructureModifier+ ] Structure Identifier
LineTerminator
[ TypeImplementsClause+ ]
[ StructMemberDeclaration+ ]
End Structure LineTerminator
StructureModifier ::= AccessModifier | Shadows
StructMemberDeclaration ::=
NonModuleDeclaration |
VariableMemberDeclaration |
ConstantMemberDeclaration |
EventMemberDeclaration |
MethodMemberDeclaration |
PropertyMemberDeclaration |
ConstructorMemberDeclaration
ModuleDeclaration ::=
[ Attributes ] [ AccessModifier+ ] Module Identifier LineTerminator
[ ModuleMemberDeclaration+ ]
End Module LineTerminator
ModuleMemberDeclaration ::=
NonModuleDeclaration |
VariableMemberDeclaration |
ConstantMemberDeclaration |
EventMemberDeclaration |
MethodMemberDeclaration |
PropertyMemberDeclaration |
ConstructorMemberDeclaration
InterfaceDeclaration ::=
[ Attributes ] [ InterfaceModifier+ ] Interface Identifier
LineTerminator
[ InterfaceBase+ ]
[ InterfaceMemberDeclaration+ ]
End Interface LineTerminator
InterfaceModifier ::= AccessModifier | Shadows
InterfaceBase ::= Inherits InterfaceBases LineTerminator
InterfaceBases ::=
TypeName |
InterfaceBases , TypeName
InterfaceMemberDeclaration ::=
NonModuleDeclaration |
EventMemberDeclaration |
MethodMemberDeclaration |
PropertyMemberDeclaration
ArrayTypeName ::= TypeName ArrayTypeModifiers
ArrayTypeModifiers ::= ArrayTypeModifier+
ArrayTypeModifier ::= ( [ RankList ] )
RankList ::=
, |
RankList ,
ArrayNameModifier ::=
ArrayTypeModifiers |
ArraySizeInitializationModifier
DelegateDeclaration ::=
[ Attributes ] [ DelegateModifier+ ] Delegate MethodDeclaration
DelegateModifier ::= AccessModifier | Shadows
ImplementsClause ::= [ Implements ImplementsList ]
ImplementsList ::=
InterfaceMemberSpecifier |
ImplementsList , InterfaceMemberSpecifier
InterfaceMemberSpecifier ::= TypeName . Identifier
MethodMemberDeclaration ::= MethodDeclaration | ExternalMethodDeclaration
MethodDeclaration ::= SubDeclaration | FunctionDeclaration
SubDeclaration ::=
[ Attributes ] [ ProcedureModifier+ ] Sub Identifier
[ ( [ ParameterList ] ) ] [ HandlesOrImplements ] LineTerminator
[ Block ]
[ End Sub LineTerminator ]
FunctionDeclaration ::=
[ Attributes ] [ ProcedureModifier+ ] Function Identifier
[ ( [ ParameterList ] ) ] [ As [ Attributes ] TypeName ]
[ HandlesOrImplements ] LineTerminator
[ Block ]
[ End Function LineTerminator ]
ProcedureModifier ::=
AccessModifier |
Shadows |
Shared |
Overridable |
NotOverridable |
MustOverride |
Overrides |
Overloads
HandlesOrImplements ::= HandlesClause | ImplementsClause
ExternalMethodDeclaration ::=
ExternalSubDeclaration |
ExternalFunctionDeclaration
ExternalSubDeclaration ::=
[ Attributes ] [ ExternalMethodModifier+ ] Declare
[ CharsetModifier ] Sub Identifier LibraryClause
[ AliasClause ] [ ( [ ParameterList ] ) ] LineTerminator
ExternalFunctionDeclaration ::=
[ Attributes ] [ ExternalMethodModifier+ ] Declare
[ CharsetModifier ] Function Identifier LibraryClause
[ AliasClause ] [ ( [ ParameterList ] ) ]
[ As [ Attributes ] TypeName ] LineTerminator
ExternalMethodModifier ::= AccessModifier | Shadows | Overloads
CharsetModifier ::= Ansi | Unicode | Auto
LibraryClause ::= Lib StringLiteral
AliasClause ::= Alias StringLiteral
ParameterList ::=
Parameter |
ParameterList , Parameter
Parameter ::=
[ Attributes ] ParameterModifier+ Identifier [ As TypeName ]
[ = ConstantExpression ]
ParameterModifier ::= ByVal | ByRef | Optional | ParamArray
HandlesClause ::= [ Handles EventHandlesList ]
EventHandlesList ::=
EventMemberSpecifier |
EventHandlesList , EventMemberSpecifier
EventMemberSpecifier ::=
Identifier . Identifier
MyBase . Identifier
ConstructorMemberDeclaration ::=
[ Attributes ] [ ConstructorModifier+ ] Sub New
[ ( [ ParameterList ] ) ] LineTerminator
[ Block ]
End Sub LineTerminator
ConstructorModifier ::= AccessModifier | Shared
EventMemberDeclaration ::=
[ Attributes ] [ EventModifiers+ ] Event Identifier ParametersOrType
[ ImplementsClause ] LineTerminator
ParametersOrType ::=
[ ( [ ParameterList ] ) ] |
As TypeName
EventModifiers ::= AccessModifier | Shadows | Shared
ConstantMemberDeclaration ::=
[ Attributes ] [ ConstantModifier+ ] Const
ConstantDeclarators LineTerminator
ConstantModifier ::= AccessModifier | Shadows
ConstantDeclarators ::=
ConstantDeclarator |
ConstantDeclarators , ConstantDeclarator
ConstantDeclarator ::= Identifier [ As TypeName ] =
ConstantExpression LineTerminator
VariableMemberDeclaration ::=
[ Attributes ] [ VariableModifier+ ] [ Dim ] VariableDeclarators
LineTerminator
VariableModifier ::=
AccessModifier |
Shadows |
Shared |
ReadOnly |
WithEvents
VariableDeclarators ::=
VariableDeclarator |
VariableDeclarators , VariableDeclarator
VariableDeclarator ::=
VariableIdentifiers [ As TypeName ] |
VariableIdentifier [ As [ New ] TypeName [ ( ArgumentList ) ] ]
[ = VariableInitializer ]
VariableIdentifiers ::=
VariableIdentifier |
VariableIdentifiers , VariableIdentifier
VariableIdentifier ::= Identifier [ ArrayNameModifier ]
VariableInitializer ::= RegularInitializer | ArrayElementInitializer
RegularInitializer ::= Expression
ArraySizeInitializationModifier ::=
( UpperBoundList ) [ ArrayTypeModifiers ]
UpperBoundList::=
Expression |
UpperBoundList , Expression
ArrayElementInitializer ::= { [ VariableInitializerList ] }
VariableInitializerList ::=
VariableInitializer |
VariableInitializerList , VariableInitializer
VariableInitializer ::= Expression | ArrayElementInitializer
PropertyMemberDeclaration ::=
[ Attributes ] [ PropertyModifier+ ] Property Identifier
[ ( [ ParameterList ] ) ] [ As TypeName ] [ ImplementsClause ]
LineTerminator
[ PropertyAccessorDeclaration+ ]
[ End Property LineTerminator ]
PropertyModifier ::= ProcedureModifier | Default | ReadOnly | WriteOnly
PropertyAccessorDeclaration ::=
PropertyGetDeclaration |
PropertySetDeclaration
PropertyGetDeclaration ::=
[ Attributes ] Get LineTerminator
[ Block ]
End Get
PropertySetDeclaration ::=
[ Attributes ] Set [ ( ParameterList ) ] LineTerminator
[ Block ]
End Set
Statement ::=
LocalDeclarationStatement |
WithStatement |
SyncLockStatement |
EventStatement |
AssignmentStatement |
InvocationStatement |
ConditionalStatement |
LoopStatement |
ErrorHandlingStatement |
BranchStatement |
ArrayHandlingStatement
StatementTerminator ::= LineTerminator | :
Block ::= [ LabeledLine+ ]
LabeledLine ::= [ LabelName : ] [ Statements ] LineTerminator
LabelName ::= Identifier | IntLiteral
Statements ::=
[ Statement ] |
Statements : [ Statement ]
LocalDeclarationStatement ::=
LocalModifier LocalDeclarators StatementTerminator
LocalModifier ::= Static | Dim | Const
LocalDeclarators ::=
LocalDeclarator |
LocalDeclarators , LocalDeclarator
LocalDeclarator ::=
LocalIdentifiers [ As TypeName ] |
LocalIdentifier [ As [ New ] TypeName [ ( [ ArgumentList ] ) ] ]
[ = VariableInitializer ]
LocalIdentifiers ::=
LocalIdentifier |
LocalIdentifiers , LocalIdentifier
LocalIdentifier ::= Identifier [ ArrayNameModifier ]
WithStatement ::=
With Expression StatementTerminator
[ Block ]
End With StatementTerminator
SyncLockStatement ::=
SyncLock Expression StatementTerminator
[ Block ]
End SyncLock StatementTerminator
EventStatement ::=
RaiseEventStatement |
AddHandlerStatement |
RemoveHandlerStatement
RaiseEventStatement ::= RaiseEvent SimpleNameExpression
[ ( [ ArgumentList ] ) ] StatementTerminator
AddHandlerStatement ::=
AddHandler Expression , Expression StatementTerminator
RemoveHandlerStatement ::=
RemoveHandler Expression , Expression StatementTerminator
AssignmentStatement ::=
RegularAssignmentStatement |
CompoundAssignmentStatement |
MidAssignmentStatement
RegularAssignmentStatement ::=
Expression = Expression StatementTerminator
CompoundAssignmentStatement ::=
Expression CompoundBinaryOperator = Expression StatementTerminator
CompoundBinaryOperator ::= ^ | * | / | \ | + | - | & | < < | > >
MidAssignmentStatement ::=
Mid [ $ ] ( Expression , Expression [ , Expression ] ) =
Expression StatementTerminator
InvocationStatement ::= [ Call ] InvocationExpression StatementTerminator
ConditionalStatement ::= IfStatement | SelectStatement
IfStatement ::= BlockIfStatement | LineIfThenStatement
BlockIfStatement ::=
If Expression [ Then ] StatementTerminator
[ Block ]
[ ElseIfStatement+ ]
[ ElseStatement ]
End If StatementTerminator
ElseIfStatement ::=
ElseIf Expression [ Then ] StatementTerminator
[ Block ]
ElseStatement ::=
Else StatementTerminator
[ Block ]
LineIfThenStatement ::=
If Expression Then [Statements ] [ Else Statements ]
StatementTerminator
SelectStatement ::=
Select [ Case ] Expression StatementTerminator
[ CaseStatement+ ]
[ CaseElseStatement ]
End Select StatementTerminator
CaseStatement ::=
Case CaseClauses StatementTerminator
[ Block ]
CaseClauses ::=
CaseClause |
CaseClauses , CaseClause
CaseClause ::=
[ Is ] ComparisonOperator Expression |
Expression [ To Expression ]
ComparisonOperator ::= = | < > | < | > | = > | = <
CaseElseStatement ::=
Case Else StatementTerminator
[ Block ]
LoopStatement ::=
WhileStatement |
DoLoopStatement |
ForStatement |
ForEachStatement
WhileStatement ::=
While Expression StatementTerminator
[ Block ]
End While StatementTerminator
DoLoopStatement ::=
Do [ WhileOrUntil Expression ] StatementTerminator
[ Block ]
Loop [ WhileOrUntil Expression ] StatementTerminator
WhileOrUntil ::= While | Until
ForStatement ::=
For LoopControlVariable = Expression To Expression [ Step Expression ]
StatementTerminator
[ Block ]
Next [ NextExpressionList ] StatementTerminator
LoopControlVariable ::=
Identifier As TypeName |
Expression
NextExpressionList ::=
Expression |
NextExpressionList , Expression
ForEachStatement ::=
For Each LoopControlVariable In Expression StatementTerminator
[ Block ]
Next [Expression ] StatementTerminator
ErrorHandlingStatement ::=
StructuredErrorStatement |
UnstructuredErrorStatement
StructuredErrorStatement ::=
ThrowStatement |
TryStatement
TryStatement ::=
Try StatementTerminator
[ Block ]
[ CatchStatement+ ]
[ FinallyStatement ]
End Try StatementTerminator
FinallyStatement ::=
Finally StatementTerminator
[ Block ]
CatchStatement ::=
Catch [ Identifier As TypeName ] [ When BooleanExpression ]
StatementTerminator
[ Block ]
ThrowStatement ::= Throw [ Expression ] StatementTerminator
UnstructuredErrorStatement ::=
ErrorStatement |
OnErrorStatement |
ResumeStatement
ErrorStatement ::= Error Expression StatementTerminator
OnErrorStatement ::= On Error ErrorClause StatementTerminator
ErrorClause ::=
GoTo - 1 |
GoTo 0 |
GotoStatement |
Resume Next
ResumeStatement ::= Resume [ ResumeClause ] StatementTerminator
ResumeClause ::= Next | LabelName
BranchStatement ::=
GotoStatement |
ExitStatement |
StopStatement |
EndStatement |
ReturnStatement
GotoStatement ::= GoTo LabelName StatementTerminator
ExitStatement ::= Exit ExitKind StatementTerminator
ExitKind ::= Do | For | While | Select | Sub | Function | Property | Try
StopStatement ::= Stop StatementTerminator
EndStatement ::= End StatementTerminator
ReturnStatement ::= Return [ Expression ]
ArrayHandlingStatement ::=
RedimStatement |
EraseStatement
RedimStatement ::= ReDim [ Preserve ] RedimClauses StatementTerminator
RedimClauses ::=
RedimClause |
RedimClauses , RedimClause
RedimClause ::= Expression ArraySizeInitializationModifier
EraseStatement ::= Erase EraseExpressions StatementTerminator
EraseExpressions ::=
Expression |
EraseExpressions , Expression
Expression ::=
SimpleExpression |
TypeExpression |
MemberAccessExpression |
DictionaryAccessExpression |
IndexExpression |
NewExpression |
CastExpression |
OperatorExpression
ConstantExpression ::= Expression
SimpleExpression ::=
LiteralExpression |
ParenthesizedExpression |
InstanceExpression |
SimpleNameExpression |
AddressOfExpression
LiteralExpression ::= Literal
ParenthesizedExpression ::= ( Expression )
InstanceExpression ::= Me | MyClass | MyBase
SimpleNameExpression ::= Identifier
AddressOfExpression ::= AddressOf Expression
TypeExpression ::=
GetTypeExpression |
TypeOfIsExpression |
IsExpression
GetTypeExpression ::= GetType ( TypeName )
TypeOfIsExpression ::= TypeOf Expression Is TypeName
IsExpression ::= Expression Is Expression
MemberAccessExpression ::=
[ [ MemberAccessBase ] . ] IdentifierOrKeyword
MemberAccessBase ::= Expression | BuiltInTypeName
DictionaryAccessExpression ::= [ Expression ] ! IdentifierOrKeyword
InvocationExpression ::= Expression [ ( [ ArgumentList ] ) ]
ArgumentList ::=
PositionalArgumentList , NamedArgumentList |
PositionalArgumentList |
NamedArgumentList
PositionalArgumentList ::=
Expression |
PositionalArgumentList , [ Expression ]
NamedArgumentList ::=
IdentifierOrKeyword : = Expression |
NamedArgumentList , IdentifierOrKeyword : = Expression
IndexExpression ::= Expression ( [ ArgumentList ] )
NewExpression ::=
ObjectCreationExpression |
ArrayCreationExpression |
DelegateCreationExpression
ObjectCreationExpression ::= New TypeName [ ( [ ArgumentList ] ) ]
ArrayCreationExpression ::=
New TypeName [ ArraySizeInitializationModifier ]
ArrayElementInitializer
DelegateCreationExpression ::= New TypeName ( Expression )
CastExpression ::=
DirectCast ( Expression , TypeName ) |
CType ( Expression , TypeName ) |
CastTarget ( Expression )
CastTarget ::=
CBool | CByte | CChar | CDate | CDec | CDbl |
CInt | CLng | CObj | CShort | CSng | CStr
OperatorExpression ::=
ArithmeticOperatorExpression |
RelationalOperatorExpression |
LikeOperatorExpression |
ConcatenationOperatorExpression |
ShortCircuitLogicalOperatorExpression |
LogicalOperatorExpression |
ShiftOperatorExpression
ArithmeticOperatorExpression ::=
UnaryPlusExpression |
UnaryMinusExpression |
AdditionOperatorExpression |
SubtractionOperatorExpression |
MultiplicationOperatorExpression |
DivisionOperatorExpression |
ModuloOperatorExpression |
ExponentOperatorExpression
UnaryPlusExpression ::= + Expression
UnaryMinusExpression ::= - Expression
AdditionOperatorExpression ::= Expression + Expression
SubtractionOperatorExpression ::= Expression - Expression
MultiplicationOperatorExpression ::= Expression * Expression
DivisionOperatorExpression ::=
FPDivisionOperatorExpression |
IntegerDivisionOperatorExpression
FPDivisionOperatorExpression ::= Expression / Expression
IntegerDivisionOperatorExpression ::= Expression \ Expression
ModuloOperatorExpression ::= Expression Mod Expression
ExponentOperatorExpression ::= Expression ^ Expression
RelationalOperatorExpression ::=
Expression = Expression |
Expression < > Expression |
Expression < Expression |
Expression > Expression |
Expression < = Expression |
Expression > = Expression
LikeOperatorExpression ::= Expression Like Expression
ConcatenationOperatorExpression ::= Expression & Expression
LogicalOperatorExpression ::=
Not Expression |
Expression And Expression |
Expression Or Expression |
Expression Xor Expression
ShortCircuitLogicalOperatorExpression ::=
Expression AndAlso Expression |
Expression OrElse Expression
ShiftOperatorExpression ::=
Expression << Expression |
Expression >> Expression