Export (0) Print
Expand All

1.1 Grammar Notation

Visual Studio .NET 2003

This specification describes two grammars: a lexical grammar and a syntactic grammar. The lexical grammar defines how characters can be combined to form tokens; the syntactic grammar defines how the tokens can be combined to form Visual Basic .NET programs. There are also several secondary grammars used for preprocessing operations like conditional compilation.

Note   The grammars in this specification are designed to be human readable, not formal (that is, usable by LEX or YACC).

All of the grammars use a modified BNF notation, which consists of a set of productions made up of terminal and non-terminal names. A terminal name represents one or more Unicode characters. Each nonterminal name is defined by one or more productions. In a production, nonterminal names are shown in italic type, and terminal names are shown in a bold type. Text in normal type and surrounded by angle-bracket metasymbols are informal terminals (for example, "< all Unicode characters >"). Each grammar starts with the nonterminal Start.

Case is unimportant in Visual Basic .NET programs. For simplicity, all terminals will be given in standard casing, but any casing will match them. Terminals that are printable elements of the ASCII character set are represented by their corresponding ASCII characters. Visual Basic .NET is also width insensitive when matching terminals, allowing full-width Unicode characters to match their half-width Unicode equivalents.

A set of productions begins with the name of a nonterminal, followed by two colons and an equal sign. The right side contains a terminal or nonterminal production. A nonterminal may have multiple productions that are separated by the vertical-bar metasymbol (|). Items included in square-bracket metasymbols ([]) are optional. A plus metasymbol (+) following an item means the item may occur one or more times.

Line breaks and indentation may be added for readability and are not part of the production.

See Also

1. Introduction

Show:
© 2014 Microsoft