1 Lexical Structure

1.1 White Space and Comments

1.1.1 Syntax

white-space-and-comments (space | comment)+
space 'any ASCII whitespace character'
comment line-comment | block-comment
line-comment // [^\n\r]*
block-comment /* (any-char*/)* */
any-char 'any character'

For an explanation of the used syntax notation, see Appendix A.

1.2 Keywords

1.2.1 Syntax

keyword abstract | as | base | bool | break | byte | case | cast | catch | char | class | const | continue | default | delegate | do | double | else | enum | false | finally | float | for | foreach | goto | if | in | inline | int | interface | internal | is | lock | long | namespace | new | null | object | operator | override | private | protected | public | ref | return | sbyte | short | static | string | switch | this | throw | true | try | ulong | uint | ushort | using | virtual | void | while

1.3 Identifiers

1.3.1 Syntax

identifier id-char-sequencekeyword
qualified-id identifier (.identifier)*
id-char-sequence (letter | _ ) (letter | digit | _ )*
letter 'any Unicode letter character (category Lu, Ll, LC, Lm, Lo and Lt) encoded using UTF-8 encoding'
digit 'any Unicode number character (category Nd, Nl and No) encoded using UTF-8 encoding'

1.4 Literals

1.4.1 Syntax

literal boolean-literal | floating-literal | integer-literal | char-literal | string-literal |
null-literal
boolean-literal true | false
floating-literal floating-literal-value [fF]?
floating-literal-value fractional-floating-literal | exponent-floating-literal
fractional-floating-literal decimal-digit-sequence? . decimal-digit-sequence exponent-part? |
decimal-digit-sequence .
exponent-floating-literal decimal-digit-sequence exponent-part
exponent-part [eE] sign? decimal-digit-sequence
integer-literal integer-literal-value [uU]?
integer-literal-value hexadecimal-integer-literal | decimal-integer-literal
hexadecimal-integer-literal ("0x" | "0X") hexadecimal-digit-sequence
decimal-integer-literal decimal-digit-sequence
char-literal ' ([^\n\r]+ | char-escape) '
string-literal @" [^"]* " |
" ([^"\\\r\n]+ | char-escape)* "
null-literal null
char-escape \\
( [xX] hexadecimal-digit-sequence | [dD] decimal-digit-sequence |
octal-digit-sequence | u four-hex-digits | U eight-hex-digits |
a | b | f | n | r | t | v | any-char
)
decimal-digit-sequence [09]+
hexadecimal-digit-sequence hex-digit+
four-hex-digits hex-digit hex-digit hex-digit hex-digit
eight-hex-digits hex-digit hex-digit hex-digit hex-digit hex-digit hex-digit hex-digit hex-digit
hex-digit [09 af AF]
octal-digit-sequence [07]+
sign + | -