我是靠谱客的博主 追寻雪碧,最近开发中收集的这篇文章主要介绍5. Notational conventions,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

Lexical and syntactic grammars for C# are interspersed throughout this
specification. The lexical grammar
defines how characters can be combined to form tokens (§9.4), the minimal
lexical elements of the language.
The syntactic grammar defines how tokens can be combined to make valid C#
programs.
Grammar productions include both non-terminal and terminal symbols. In
grammar productions, nonterminal
symbols are shown in italic type, and terminal symbols are shown in a
fixed-width font. Each
non-terminal is defined by a set of productions. The first line of a set of
productions is the name of the nonterminal,
followed by one or two colons. One colon is used for a production in the
syntactic grammar, two
colons for a production in the lexical grammar. Each successive indented
line contains the right-hand side
for a production that has the non-terminal symbol as the left-hand side.
For example:
class-modifier:
new
public
protected
internal
private
abstract
sealed
defines the class-modifier non-terminal as having seven productions.
Alternatives are normally listed on separate lines, as shown above, though
in cases where there are many
alternatives, the phrase .one of. precedes a list of the options. This is
simply shorthand for listing each of
the alternatives on a separate line. For example:
decimal-digit: one of
0 1 2 3 4 5 6 7 8 9
is equivalent to:
decimal-digit:
0
1
2
3
4
5
6
7
8
9
A subscripted suffix .opt., as in identifieropt, is used as shorthand to
indicate an optional symbol. The
example:
for-statement:
for ( for-initializeropt ; for-conditionopt ; for-iteratoropt )
embedded-statement
is equivalent to:

最后

以上就是追寻雪碧为你收集整理的5. Notational conventions的全部内容,希望文章能够帮你解决5. Notational conventions所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(51)

评论列表共有 0 条评论

立即
投稿
返回
顶部