虚汗是什么症状| 身上长水泡是什么原因| 抽血能检查出什么| 脆豆腐是什么做的| 1959属什么生肖| 110斤穿什么码衣服| 以示是什么意思| 120是什么电话| beacon什么意思| 爬山膝盖疼是什么原因| image什么意思| 中国最长的河流是什么| 犀利的眼神是什么意思| 欧巴是什么意思| 属龙的本命佛是什么佛| 什么是手机号| 经常吃红枣有什么好处和坏处| 吃洋葱有什么好处和坏处| 做肠镜要挂什么科| 久而久之下一句是什么| 什么病不能吃空心菜| 维生素检查项目叫什么| 什么病属于重大疾病| 揪心是什么意思| 92是什么| 上眼药什么意思| 公主病是什么意思| 闲是什么生肖| 子官肌瘤吃什么食物| 什么的朝霞| 为什么会得肺癌| 什么咖啡好喝| 幽门杆菌是什么意思| 子宫粘连有什么症状| 前方起飞是什么意思| 坐月子适合吃什么水果| 胸部胀疼是什么原因| 曹仁和曹操什么关系| 黄体酮是什么意思| 今年是什么年庚| 场记是做什么的| 神经损伤吃什么药最好| 天牛吃什么| 机缘是什么意思| 天月二德是什么意思| 儿童抗o高会引起什么病| 胆固醇低是什么原因| 斗战胜佛是什么意思| 一个田一个比读什么| 铁剂什么时候吃最好| 属蛇的贵人是什么属相| 属牛男最在乎女人什么| 绿萝叶子发黄是什么原因| 地贫和贫血有什么区别| 黑灰色是什么颜色| a代表什么意思| 橘红是什么东西| 怀孕10天左右有什么症状| 中国现在是什么社会| 什么样的人容易得脑瘤| 打嗝不停吃什么药| 高冷什么意思| butter是什么意思| 男性睾丸一边大一边小是什么原因| 北斗是什么意思| 总是拉稀是什么原因| 尾款是什么意思| 豆芽和什么一起炒好吃| 下面瘙痒用什么药膏| 铁线虫是什么| 马失前蹄下一句是什么| 晨字属于五行属什么| 什么动物最容易摔倒| 提前吃什么喝酒不醉| 无水酥油是什么| 榴莲和什么水果相克| 脂肪肝应注意什么| 水杯用什么材质的好| 纳豆是什么豆| 94年属什么的| gucci中文叫什么牌子| 狗生小狗前有什么征兆| 肾结石是由什么原因引起的| 三级士官是什么级别| 减肥中午吃什么| 肾火旺吃什么药| 孕酮是什么意思| 殿试第一名叫什么| 感觉心慌是什么原因| 2019年出生属什么生肖| 制加手念什么| 囊肿有什么症状| 胃疼胃胀吃什么药好| 卵圆孔未闭是什么意思| 肺有问题会出现什么症状| 悬是什么意思| 女人小腹坠痛是什么原因| 心肌酶能查出什么病| 肾挂什么科| 耳朵大代表什么| 眼皮跳是什么预兆| 腋下副乳有什么危害吗| 肚子疼呕吐是什么原因引起的| 肛门周边瘙痒擦什么药| 心动过速是什么原因| 区教育局局长是什么级别| 打粉是什么意思| 是什么星座| 为什么大熊猫是国宝| 脚底板出汗是什么原因| 流鼻血不止是什么原因| 手心脱皮是什么原因| 孕妇的尿液有什么用途| 请大家知悉是什么意思| 女人梦见蛇预示着什么| 皂角米是什么东西| 腰椎间盘突出不能吃什么食物| 过期的酸奶有什么用| 吃什么最养胃修复胃| 什么的油菜花| 猪古代叫什么| 查hpv挂什么科| 牙周炎吃什么药好| 八月十七是什么星座| 中元节应该说什么| 男人吃什么壮阳最快| 长期便秘是什么原因引起的| 番薯是什么意思| 吃什么降血压的食物| 绿色裤子配什么上衣| 交易是什么意思| lr是什么| 眼角长脂肪粒是什么原因| 吃什么补阳气最快| 焦俊艳和焦恩俊是什么关系| 死精吃什么能调理成活精| 6月29日是什么星座| h什么意思| 卧底归来大结局是什么| 恋物癖是什么| 电影bd是什么意思| 荆州是现在的什么地方| 伊朗用什么货币| 唇炎看什么科最好| 大姨妈有血块是什么原因| 肉桂是什么东西| 什么鱼吃玉米| 腿长身子短有什么说法| 甘油是什么油| 羊奶和牛奶有什么区别| 军加皮念什么| 青年是什么意思| cm2是什么单位| 碧字五行属什么| 痛心疾首的疾是什么意思| 世界第八大奇迹是什么| 嘴唇没有血色是什么原因| 痛风吃什么菜比较好| ttm是什么意思| 科学是什么| 扁平疣用什么药膏除根| 下巴下面长痘痘是什么原因| 北京为什么叫北平| 梦到死人了有什么兆头| 女的右眼跳代表什么| 疼和痛有什么区别| 雨云是什么字| 肛门瘙痒用什么药膏| 淡淡的什么| cs和cf有什么区别| 赘疣是什么意思| 花儿为什么那么红| 1977年是什么年| 梦见已故老人是什么预兆| 手和脚脱皮是什么原因| 屈光不正是什么意思| 一什么阳光| 三途苦是指的什么| 17数字代表什么意思| 怀孕头三个月吃什么好| 人间仙境是什么意思| 西洋参可以和什么一起泡水喝| 什么是三重一大事项| 生育保险是什么意思| 百花齐放是什么生肖| 爱马仕是什么意思| 梦到好多小蛇是什么意思| 梦见把蛇打死了是什么意思| 猪肚是什么器官| 感谢是什么意思| 花千骨什么时候上映的| 副团级是什么军衔| 黑色的鸟是什么鸟| 更年期失眠吃什么药效果好| 梦见自己生病了是什么意思| ab和o型血生的孩子是什么血型| 699是什么意思| 好事将近是什么意思| 师参谋长是什么军衔| 内衣什么品牌最好| 肺部肿瘤3cm什么期| 蓝色妖姬适合送什么人| 热伤风是什么意思| 头上长痘痘是什么原因| 排湿气最快的方法吃什么| 头晕出冷汗是什么原因| 七匹狼属于什么档次| 胰腺炎为什么血糖高| 马马虎虎指什么生肖| 稀盐酸是什么| 脉细滑是什么意思| 笔记本电脑什么牌子好| 扁平疣用什么药膏除根| 蚊子喜欢咬什么血型| 棒棒糖是什么意思| 自媒体是什么| 翩跹是什么意思| 齿痕舌吃什么中成药| kcl是什么药| 午时银花露有什么功效| 风疹病毒抗体igg阳性是什么意思| yellow是什么颜色| 胸口闷痛挂什么科| 为什么午觉睡醒后头疼| 楔形是什么形状| 什么食物清肺化痰| 头发里长痣代表什么| 肾结石检查什么项目| gf什么意思| 什么令什么申| twin什么意思| 兔头是什么意思| 解除是什么意思| 婴儿大便绿色是什么原因| 吃什么补胰腺最好| 吃生蚝补什么| 血糖偏高能吃什么水果| 穿山甲说了什么| 金木水火土各代表什么| 金钱龟吃什么食物| 肾结晶是什么病| 拥趸是什么意思| 实性结节什么意思| 20分贝相当于什么声音| 球蛋白的功效与作用是什么| 什么是思想| 55年出生属什么| 老玻璃是什么意思| 十一月二十九是什么星座| 知了的学名叫什么| 霉菌阴道炎用什么药| 蚊子怕什么气味| 小孩咬人是什么原因| 为什么手抖| 森林里有什么| 汉族是什么人种| 肛周脓肿挂什么科| 3月21号是什么星座| 白带多要吃什么药| psp是什么| 止咳平喘什么药最有效| 细菌感染引起的发烧吃什么药| 肺部有空洞是什么病症| 胃痛怎么办吃什么药| 百度Jump to content

科考结果称在贵州发现“亚洲第一长洞” 长度刷新至238.48千米

From Wikipedia, the free encyclopedia
百度 工联会立法会议员何启明批评,港独分子行为猖獗,美其名是谈自由及人权,实际上是分裂国家组织的聚会,联同其他倡独分子挑战国家底线,冲击香港行之有效的制度。

In computer programming, a programming language specification (or standard or definition) is a documentation artifact that defines a programming language so that users and implementors can agree on what programs in that language mean. Specifications are typically detailed and formal, and primarily used by implementors, with users referring to them in case of ambiguity; the C++ specification is frequently cited by users, for instance, due to the complexity. Related documentation includes a programming language reference, which is intended expressly for users, and a programming language rationale, which explains why the specification is written as it is; these are typically more informal than a specification.

Standardization

[edit]

Not all major programming languages have specifications, and languages can exist and be popular for decades without a specification. A language may have one or more implementations, whose behavior acts as a de facto standard, without this behavior being documented in a specification. Perl (through Perl 5) is a notable example of a language without a specification, while PHP was only specified in 2014, after being in use for 20 years.[1] A language may be implemented and then specified, or specified and then implemented, or these may develop together, which is usual practice today. This is because implementations and specifications provide checks on each other: writing a specification requires precisely stating the behavior of an implementation, and implementation checks that a specification is possible, practical and consistent. Writing a specification before an implementation has largely been avoided since ALGOL 68 (1968), due to unexpected difficulties in implementation when implementation is deferred. However, languages are still occasionally implemented and gain popularity without a formal specification: an implementation is essential for use, while a specification is desirable but not essential (informally, "code talks").

ALGOL 68 was the first (and possibly one of the last) major language for which a full formal definition was made before it was implemented.

Forms

[edit]

A programming language specification can take several forms, including:

  • An explicit definition of the syntax and semantics of the language. While syntax is commonly specified using a formal grammar, semantic definitions may be written in natural language (e.g., the approach taken for the C language), or a formal semantics (e.g., the Standard ML[3] and Scheme[4] specifications). A notable example is the C language, which gained popularity without a formal specification, instead being described as part of a book, The C Programming Language (1978), and only much later being formally standardized in ANSI C (1989).
  • A description of the behavior of a compiler (sometimes called "translator") for the language (e.g., the C++ language and Fortran). The syntax and semantics of the language has to be inferred from this description, which may be written in natural or a formal language.
  • A model implementation, sometimes written in the language being specified (e.g., Prolog). The syntax and semantics of the language are explicit in the behavior of the model implementation.

Syntax

[edit]

The syntax of a programming language represents the definition of acceptable words, i.e., formal parameters and rules upon which to decide whether a given code is valid in respect to the language. On that note, the language syntax usually consists of a combination of the following three construction components:

  • A specific character set (non-empty, finite set of symbols)
  • Regular expressions describing its lexemes (for alphabet-wise tokenisation)
  • A context-free grammar which describes how the lexemes may be combined in order to form a correct program

Syntax specification generally supposes a natural language description in order to provide modest comprehensibility. However, the formal representation of the above outlined components is usually part of the section as it favors the implementation and approval of the language and its concepts.

Semantics

[edit]

Formulating a rigorous semantics of a large, complex, practical programming language is a daunting task even for experienced specialists, and the resulting specification can be difficult for anyone but experts to understand. The following are some of the ways in which programming language semantics can be described; all languages use at least one of these description methods, and some languages combine more than one.[5]

Natural language

[edit]

Most widely used languages are specified using natural language descriptions of their semantics. This description usually takes the form of a reference manual for the language. These manuals can run to hundreds of pages; e.g., the print version of The Java Language Specification, 3rd Ed. is 596 pages.[6]

The imprecision of natural language as a vehicle for describing programming language semantics can lead to problems with interpreting the specification. For example, the semantics of Java threads were specified in English, and it was later discovered that the specification did not provide adequate guidance for implementors.[7]

Formal semantics

[edit]

Formal semantics are grounded in mathematics. As a result, they can be more precise and less ambiguous than semantics given in natural language. However, supplemental natural language descriptions of the semantics are often included to aid understanding of the formal definitions. For example, The ISO Standard for Modula-2 contains both a formal and a natural language definition on opposing pages.

Programming languages whose semantics are described formally can reap many benefits. For example:

  • Formal semantics enable mathematical proofs of program correctness;
  • Formal semantics facilitate the design of type systems, and proofs about the soundness of those type systems;
  • Formal semantics can establish unambiguous and uniform standards for implementations of a language.

Automatic tool support can help to realize some of these benefits. For example, an automated theorem prover or theorem checker can increase a programmer's (or language designer's) confidence in the correctness of proofs about programs (or the language itself). The power and scalability of these tools varies widely: full formal verification is computationally intensive, rarely scales beyond programs containing a few hundred lines[citation needed] and may require considerable manual assistance from a programmer; more lightweight tools such as model checkers require fewer resources and have been used on programs containing tens of thousands of lines; many compilers apply static type checks to any program they compile.

Reference implementation

[edit]

A reference implementation is a single implementation of a programming language that is designated as authoritative. The behavior of this implementation is held to define the proper behavior of a program written in the language. This approach has several attractive properties. First, it is precise, and requires no human interpretation: disputes as to the meaning of a program can be settled simply by executing the program on the reference implementation (provided that the implementation behaves deterministically for that program).

On the other hand, defining language semantics through a reference implementation also has several potential drawbacks. Chief among them is that it conflates limitations of the reference implementation with properties of the language. For example, if the reference implementation has a bug, then that bug must be considered to be an authoritative behavior. Another drawback is that programs written in this language may rely on quirks in the reference implementation, hindering portability across different implementations.

Nevertheless, several languages have successfully used the reference implementation approach. For example, the Perl interpreter is considered to define the authoritative behavior of Perl programs. In the case of Perl, the open-source model of software distribution has contributed to the fact that nobody has ever produced another implementation of the language, so the issues involved in using a reference implementation to define the language semantics are moot.

Test suite

[edit]

Defining the semantics of a programming language in terms of a test suite involves writing a number of example programs in the language, and then describing how those programs ought to behave—perhaps by writing down their correct outputs. The programs, plus their outputs, are called the "test suite" of the language. Any correct language implementation must then produce exactly the correct outputs on the test suite programs.

The chief advantage of this approach to semantic description is that it is easy to determine whether a language implementation passes a test suite. The user can simply execute all the programs in the test suite, and compare the outputs to the desired outputs. However, when used by itself, the test suite approach has major drawbacks as well. For example, users want to run their own programs, which are not part of the test suite; indeed, a language implementation that could only run the programs in its test suite would be largely useless. But a test suite does not, by itself, describe how the language implementation should behave on any program not in the test suite; determining that behavior requires some extrapolation on the implementor's part, and different implementors may disagree. In addition, a test suite cannot easily test behavior that is intended or allowed to be nondeterministic.

Therefore, in common practice, test suites are used only in combination with one of the other language specification techniques, such as a natural language description or a reference implementation.

[edit]

Language specifications

[edit]

A few examples of official or draft language specifications:

Notes

[edit]
  1. ^ Announcing a specification for PHP, July 30, 2014, Joel Marcey
  2. ^ "A Shorter History of Algol68". Archived from the original on August 10, 2006. Retrieved September 15, 2006.
  3. ^ Milner, R.; M. Tofte; R. Harper; D. MacQueen (1997). The Definition of Standard ML (Revised). MIT Press. ISBN 0-262-63181-4.
  4. ^ Kelsey, Richard; William Clinger; Jonathan Rees (February 1998). "Section 7.2 Formal semantics". Revised5 Report on the Algorithmic Language Scheme. Retrieved 2025-08-05.
  5. ^ Jones, D. (2008). Forms of language specification (PDF). Retrieved 2025-08-05.
  6. ^ Gosling, James; Joy, Bill; Steele, Guy; Bracha, Gilad (June 2005). "The Java Language Specification, Third Edition". Addison-Wesley Longman.
  7. ^ William Pugh. The Java Memory Model is Fatally Flawed. Concurrency: Practice and Experience 12(6):445-455, August 2000
网店卖什么好 红萝卜和胡萝卜有什么区别 店招是什么意思 白喉是什么意思 甲状腺肿大是什么原因引起
淋巴结核是什么病 七月份适合种什么菜 宫内小囊是什么意思 脑膜炎有什么症状 做梦拉屎是什么意思
庙宇是什么意思 三十而立四十不惑什么意思 血糖高吃什么药 孟母三迁的故事告诉我们什么道理 立夏有什么习俗
小病不治下一句是什么 做包皮手术挂什么科 交易是什么意思 尿道口长肉芽是什么 割包皮属于什么科
2008年属什么生肖hcv9jop2ns5r.cn tp代表什么hcv9jop7ns3r.cn 8月29号是什么日子hcv8jop1ns6r.cn 朱元璋为什么不杀朱棣hcv9jop2ns1r.cn 有样学样是什么意思hcv7jop9ns7r.cn
奶瓶pp和ppsu有什么区别qingzhougame.com 二月十号是什么星座hcv8jop1ns6r.cn 什么是姑息治疗hcv7jop6ns1r.cn 为什么一到晚上就痒hcv8jop8ns9r.cn 什么是溶血症hcv8jop3ns0r.cn
血型o型rh阳性是什么意思hcv7jop6ns6r.cn 肠炎吃什么食物调理cl108k.com 上传下达是什么意思hcv8jop4ns8r.cn 吃什么治便秘hcv8jop9ns2r.cn 自律性是什么意思520myf.com
下肢动脉硬化吃什么药hcv9jop2ns5r.cn 遍体鳞伤是什么意思wzqsfys.com 为什么蚊子咬了会起包hcv9jop1ns5r.cn hh是什么品牌hcv8jop0ns5r.cn 今年53岁属什么生肖hcv9jop4ns4r.cn
百度