Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
C-sharp language specification.2004.pdf
Скачиваний:
14
Добавлен:
23.08.2013
Размер:
2.55 Mб
Скачать

Chapter 5 Notational conventions

15. Notational conventions

2Lexical and syntactic grammars for C# are interspersed throughout this specification. The lexical grammar

3defines how characters can be combined to form tokens (§9.4), the minimal lexical elements of the language.

4The syntactic grammar defines how tokens can be combined to make valid C# programs.

5Grammar productions include both non-terminal and terminal symbols. In grammar productions, non-

6terminal symbols are shown in italic type, and terminal symbols are shown in a fixed-width font. Each

7non-terminal is defined by a set of productions. The first line of a set of productions is the name of the non-

8terminal, followed by one or two colons. One colon is used for a production in the syntactic grammar, two

9colons for a production in the lexical grammar. Each successive indented line contains the right-hand side

10for a production that has the non-terminal symbol as the left-hand side. For example:

11class-modifier:

12

new

13

public

14

protected

15

internal

16

private

17

abstract

18

sealed

19static

20defines the class-modifier non-terminal as having seven productions.

21Alternatives are normally listed on separate lines, as shown above, though in cases where there are many

22alternatives, the phrase “one of” precedes a list of the options. This is simply shorthand for listing each of

23the alternatives on a separate line. For example:

24decimal-digit: one of

25

0

1

2

3

4

5

6

7

8

9

26is equivalent to:

27decimal-digit:

28

0

29

1

30

2

31

3

32

4

33

5

34

6

35

7

36

8

379

38A subscripted suffix “opt”, as in identifieropt, is used as shorthand to indicate an optional symbol. The

39example:

40for-statement:

41

for ( for-initializeropt ; for-conditionopt ; for-iteratoropt ) embedded-statement

42

is equivalent to:

9

 

C# LANGUAGE SPECIFICATION

 

 

 

1

for-statement:

 

 

 

2

for ( ; ; ) embedded-statement

 

 

3

for

( for-initializer ; ; )

embedded-statement

4

for

( ; for-condition ; )

embedded-statement

5

for

( ; ; for-iterator )

embedded-statement

6

for

( for-initializer ; for-condition

; ) embedded-statement

7

for

( ; for-condition ; for-iterator

)

embedded-statement

8

for

( for-initializer ; ; for-iterator

)

embedded-statement

9

for

( for-initializer ; for-condition

; for-iterator ) embedded-statement

10

11All terminal characters are to be understood as the appropriate Unicode character from the range U+0020 to

12U+007F, as opposed to any similar-looking characters from other Unicode character ranges.

10

Chapter 6 Acronyms and abbreviations

16. Acronyms and abbreviations

2This clause is informative.

3The following acronyms and abbreviations are used throughout this International Standard:

4

5BCL — Base Class Library, which provides types to represent the built-in data types of the CLI, simple file

6access, custom attributes, security attributes, string manipulation, formatting, streams, and collections.

7CLI — Common Language Infrastructure

8CLS — Common Language Specification

9IEC — the International Electrotechnical Commission

10IEEE — the Institute of Electrical and Electronics Engineers

11ISO — the International Organization for Standardization

12

13The name C# is pronounced “C Sharp”.

14The name C# is written as the LATIN CAPITAL LETTER C (U+0043) followed by the NUMBER SIGN #

15(U+0023).

16End of informative text.

11

Соседние файлы в предмете Электротехника