C # Language Specification--2.2.1 grammatical notation

Source: Internet
Author: User
Tags expression
Specification

The lexical-French and syntactic-French methods are expressed in terms of grammatical production. Each grammar-generation defines a non-closing symbol and its possible extension (a sequence consisting of a non-terminator or terminator). In the grammar-generation, the non-closing symbol appears italic, and the ending symbol is displayed as a width font.

The first line of the grammar-generation is the name of the non-closing symbol defined by the formula, followed by a colon. Each subsequent indent lists a possible extension, which is given in the form of a sequence consisting of a non-terminator or terminator. For example, the production type:

While-statement: (While statement:)

while (boolean-expression) Embedded-statement (a while (Boolean expression) embedded statement)

Defines a while statement, which is composed of a tag while beginning, followed by a tag "(", Boolean expression, Tag "), and an embedded statement.

Lists these possible extensions (one row for each extension) when there is a possible non-end symbol extension. For example, the production type:

Statement-list: (statement list:)

Statement (statement)

Statement-list statement (statement list statement)

Defines a statement list that contains only one statement, or consists of a statement list and a statement followed by it. In other words, the definition is recursive, and the statement list consists of one or more statements.

A symbol is optional if the following prefix is labeled "optional". Production Type:

Block: (blocks:)

{statement-listopt} ({statement list optional})

is a short form of the following generation:

Block: (blocks:)

{   }

{Statement-list} ({statement list})

It defines a block that consists of an optional list of statements enclosed in "{" and "}" tags.

Options are usually listed on separate lines, but when there are many options, you can precede the extended list given on a single line with the phrase "one of the following." This simply lists the short form of each option on a separate line. For example, the production type:

Real-type-suffix:one of (real type suffix: one of the following)

F F D D m

is a short form of the following generation:

Real-type-suffix: (Real type suffix:)

F
F
D
D
M
M



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.