颈椎钙化是什么意思| 紧急避孕药什么时候吃最有效| 秋天都有什么| 午时是什么时候| 白茶是什么茶| 鸡枞菌生长在什么地方| 东方蝾螈吃什么| 男人吃什么壮阳最快| pB什么意思| 日本豆腐是什么做的| 音序是什么| 手发抖是什么病的先兆| 老爹鞋适合什么人穿| 宸字五行属什么| 腹部彩超能查出什么| ca724偏高是什么意思| other什么意思| 团长一般是什么军衔| 私定终身是什么意思| 梦见掉牙齿是什么征兆| mpa什么意思| 单人旁的字和什么有关| 角的大小与什么有关与什么无关| 着数是什么意思| 拉肚子引起的发烧吃什么药| 吃什么头发长的快| 梦见双头蛇是什么征兆| 小猫来家里有什么预兆| 高密度脂蛋白胆固醇偏低是什么意思| 吃什么能减脂肪肝| 晋是什么意思| 什么是矫正视力| 人的心脏在什么位置| 男人为什么会得前列腺炎| 磁共振是什么| 鹦鹉吃什么食物| 口下面一个巴念什么| 什么是排卵期| 手上起小水泡痒是什么原因| 孙子兵法是什么生肖| 38岁属什么生肖| 中古包是什么意思| 梦到狗是什么征兆| 鱼丸是什么做的| 庆帝为什么杀叶轻眉| 女的肾虚是什么原因引起的| 纳是什么| 内参是什么意思| 胰是什么器官| 贫血喝什么口服液最好| 日加匀念什么| 小儿安现在叫什么名| 重阳节为什么要插茱萸| 梦见杀鸡是什么意思| 兔子拉稀是什么原因| 经常流鼻涕是什么原因| 吃完饭恶心想吐是什么原因| vape是什么意思| 米线配菜都有什么| 宗旨是什么意思| 屎忽鬼是什么意思| 亚是什么意思| 虎头蛇尾是什么生肖| 梦见下小雨是什么征兆| 爱理不理是什么意思| 四级警长是什么级别| 晚上11点到12点是什么时辰| 什么是夹腿| 旅游带什么| 三顾茅庐的顾是什么意思| 指甲软是什么原因| 精子有点黄是什么原因| 手指头肿胀是什么原因| 梦见经血是什么预兆| 看脑血管挂什么科| 阴道流黄水是什么原因| 六月十六什么星座| 10岁属什么| 朱日和是什么意思| 麸质是什么| 尿酸高吃什么蔬菜好| bv是什么牌子| 桥本氏病是什么病| 珏字五行属什么| 足三里在什么位置图片| 酋长是什么意思| 熟地黄有什么功效| 下肢浮肿挂什么科| 一厢情愿什么意思| 女性什么时候绝经| 反清复明的组织叫什么| 包皮过长有什么影响| 小腿发胀是什么原因| 调教是什么| 降压药的原理是什么| 分泌多巴胺是什么意思| 成语是什么意思| 子宫内膜薄有什么影响| 胃疼去医院挂什么科| 胳膊脱臼是什么症状| v店是什么| 血氧是什么意思| 授受不亲什么意思| 梦见小女孩是什么预兆| bbq是什么| 为什么会孕吐| 舌苔厚白用什么泡水喝| 阴道息肉长什么样| 8月6日什么星座| 馒头配什么菜好吃| 什么汤养胃| 恶心想吐胃不舒服是什么原因| 血压偏低吃什么东西补最好| 小揪揪什么意思| 预防保健科是做什么的| 比中指是什么意思| 长期喝奶粉有什么好处| 敞开心扉是什么意思| 四不放过是什么| 什么的柳枝| 湿气重去医院挂什么科| 风花雪月是什么意思| 眉毛白了是什么原因引起的| 党工委书记是什么级别| 舌头干涩是什么病前兆| 冲虎煞南是什么意思| 什么是有意义的东西| 五行缺土戴什么| 希特勒为什么要杀犹太人| 卡不当什么意思| 什么时候绝经| 二尖瓣微量反流什么意思| 马凡氏综合症是什么病| 血糖高能吃什么蔬菜| 什么叫书签| 中元节是什么节| 什么叫邪淫| 睡觉喜欢流口水是什么原因| 什么东西有脚却不能走路| 脖子肿大是什么病的症状| 团县委是什么单位| 咽喉炎吃什么水果好| 6月17日什么星座| qs是什么| 巡演是什么意思| 做梦烧纸钱什么意思| 7月13号是什么星座| 脂肪最怕什么| 信的拼音是什么| 十八大什么时候召开的| 中年危机是什么意思| 查心梗应该做什么检查| 尿液里白细胞高是什么原因| 胆红素高吃什么食物能降得快| 心安是什么意思| 什么叫湿气| 送妈妈什么礼物好| 腋毛有什么作用| wlp是什么意思| 高良姜是什么姜| 29岁属什么| 动则气喘是什么原因| 肾结石什么不可以吃| 靴靴是什么意思| 小龙虾和什么不能一起吃| 胸前骨头疼是什么原因| 吃什么食物补钙最快| 左耳朵嗡嗡响是什么原因引起的| igm抗体阳性是什么意思| 吃辣的胃疼吃什么药| 伟五行属性是什么| 偏袒是什么意思| 走之底的字与什么有关| 这个梗是什么意思| feel什么意思| 迈之灵治什么病| 白月光是什么| 什么是毛周角化| 为什么晚上睡不着| 去势是什么意思| 什么叫膳食纤维| 儿童脾胃不好吃什么调理脾胃| 麻腮风是什么| np文是什么意思| 试管婴儿什么价格| mi是什么| mario是什么意思| 红沙日是什么意思| 脑白质疏松是什么病| 五谷中的菽是指什么| 吃什么减肥最好最快| 尿频尿急尿不尽挂什么科| 1975年是什么命| 宫腔镜是检查什么的| 男性长期熬夜吃什么好| 榕字五行属什么| 尿频尿量少是什么原因| 肺结核吃什么好| 头发爱出油什么原因| EV是什么| 被男人操是什么感觉| 儿童流鼻血什么原因引起的| 翘嘴鱼是什么鱼| 口干咽干是什么原因| 屁股出血是什么原因| 拔完智齿需要注意什么| 胆红素是什么意思| 扁桃体肥大有什么症状| 胃寒吃什么药好| 前列腺在人体什么位置| 有里面没有两横是什么字| 脚疼是什么原因| 什么球不能踢| 孩子咬指甲什么原因| 荠菜长什么样| 膝盖痛吃什么药| 一个永一个日念什么| 今年是什么年天干地支| 猫的五行属什么| kpa什么意思| 富士康是做什么的| 为什么大便是黑色的| 羡慕的什么| 小腿疼痛挂什么科| 什么叫cd| 漏斗胸是什么病| 才高八斗是指什么生肖| 男人说冷静一段时间是什么意思| 临床是什么意思| 黄腔是什么意思| 火象是什么意思| 情商什么意思| 脑震荡有什么症状| 头发湿着睡觉有什么害处| 未来是什么意思| 4级手术是什么意思| 猪血炒什么好吃| 两败俱伤是什么意思| crispy是什么意思| 急性青光眼是什么症状| 口腔溃疡喝什么| 杞人忧天告诉我们什么道理| kbs是什么意思| 什么情况下喝补液盐| 抽烟肺疼是什么原因| 什么是缘分| 临界是什么意思| 开指是什么意思| 什么是安全期和排卵期| 球镜柱镜是什么意思| 胃气胀是什么原因怎么解决| 角化异常性疾病是什么| 红色的补色是什么颜色| 木薯粉是什么东西| 作践自己是什么意思| 余情未了什么意思| 铁树开花什么样| acer是什么牌子| 禅宗是什么意思| 2044年是什么年| 感冒可以吃什么| 冰火是什么意思| 拉格啤酒是什么意思| 排骨炒什么配菜好吃| 百度Jump to content

网信事业新成就:肃宁全民电商创业网店达到6000家

From Wikipedia, the free encyclopedia
百度 制图:每日经济新闻而据未来可栖消息称,链家集团董事长左晖认为,未来北京会有1000万人租房,按人均20平米左右计算,北京需要的租房面积将达两亿平米。

In computing, a meta-circular evaluator (MCE) or meta-circular interpreter (MCI) is an interpreter which defines each feature of the interpreted language using a similar facility of the interpreter's host language. For example, interpreting a lambda application may be implemented using function application.[1] Meta-circular evaluation is most prominent in the context of Lisp.[1][2] A self-interpreter is a meta-circular interpreter where the interpreted language is nearly identical to the host language; the two terms are often used synonymously.[3]

History

[edit]

The dissertation of Corrado B?hm[4] describes the design of a self-hosting compiler.[5] Due to the difficulty of compiling higher-order functions, many languages were instead defined via interpreters, most prominently Lisp.[1][6] The term itself was coined by John C. Reynolds,[1] and popularized through its use in the book Structure and Interpretation of Computer Programs.[3][7]

Self-interpreters

[edit]

A self-interpreter is a meta-circular interpreter where the host language is also the language being interpreted.[8] A self-interpreter displays a universal function for the language in question, and can be helpful in learning certain aspects of the language.[2] A self-interpreter will provide a circular, vacuous definition of most language constructs and thus provides little insight into the interpreted language's semantics, for example evaluation strategy. Addressing these issues produces the more general notion of a "definitional interpreter".[1]

From self-interpreter to abstract machine

[edit]

This part is based on Section 3.2.4 of Danvy's thesis.[9]

Here is the core of a self-evaluator for the calculus. The abstract syntax of the calculus is implemented as follows in OCaml, representing variables with their de Bruijn index, i.e., with their lexical offset (starting from 0):

type term = IND of int    (* de Bruijn index *)
          | ABS of term
          | APP of term * term

The evaluator uses an environment:

type value = FUN of (value -> value)

let rec eval (t : term) (e : value list) : value =
  match t with
    IND n ->
     List.nth e n
  | ABS t' ->
     FUN (fun v -> eval t' (v :: e))
  | APP (t0, t1) ->
     apply (eval t0 e) (eval t1 e)
and apply (FUN f : value) (a : value) =
  f a

let main (t : term) : value =
  eval t []

Values (of type value) conflate expressible values (the result of evaluating an expression in an environment) and denotable values (the values denoted by variables in the environment), a terminology that is due to Christopher Strachey.[10][11]

Environments are represented as lists of denotable values.

The core evaluator has three clauses:

  • It maps a variable (represented with a de Bruijn index) into the value in the current environment at this index.
  • It maps a syntactic function into a semantic function. (Applying a semantic function to an argument reduces to evaluating the body of the corresponding syntactic function in its lexical environment, extended with the argument.)
  • It maps a syntactic application into a semantic application.

This evaluator is compositional in that each of its recursive calls is made over a proper sub-part of the given term. It is also higher order since the domain of values is a function space.

In "Definitional Interpreters", Reynolds answered the question as to whether such a self-interpreter is well defined. He answered in the negative because the evaluation strategy of the defined language (the source language) is determined by the evaluation strategy of the defining language (the meta-language). If the meta-language follows call by value (as OCaml does), the source language follows call by value. If the meta-language follows call by name (as Algol 60 does), the source language follows call by name. And if the meta-language follows call by need (as Haskell does), the source language follows call by need.

In "Definitional Interpreters", Reynolds made a self-interpreter well defined by making it independent of the evaluation strategy of its defining language. He fixed the evaluation strategy by transforming the self-interpreter into continuation-passing style, which is evaluation-strategy independent, as later captured in Gordon Plotkin's Independence Theorems.[12]

Furthermore, because logical relations had yet to be discovered, Reynolds made the resulting continuation-passing evaluator first order by (1) closure-converting it and (2) defunctionalizing the continuation.

He pointed out the "machine-like quality" of the resulting interpreter, which is the origin of the CEK machine since Reynolds's CPS transformation was for call by value.[13] For call by name, these transformations map the self-interpreter to an early instance of the Krivine machine.[14] The SECD machine and many other abstract machines can be inter-derived this way.[15][16]

It is remarkable that the three most famous abstract machines for the calculus functionally correspond to the same self-interpreter.

Self-interpretation in total programming languages

[edit]

Total functional programming languages that are strongly normalizing cannot be Turing complete, otherwise one could solve the halting problem by seeing if the program type-checks. That means that there are computable functions that cannot be defined in the total language.[17] In particular it is impossible to define a self-interpreter in a total programming language, for example in any of the typed lambda calculi such as the simply typed lambda calculus, Jean-Yves Girard's System F, or Thierry Coquand's calculus of constructions.[18][19] Here, by "self-interpreter" we mean a program that takes a source term representation in some plain format (such as a string of characters) and returns a representation of the corresponding normalized term. This impossibility result does not hold for other definitions of "self-interpreter". For example, some authors have referred to functions of type as self-interpreters, where is the type of representations of -typed terms. To avoid confusion, we will refer to these functions as self-recognizers. Brown and Palsberg showed that self-recognizers could be defined in several strongly-normalizing languages, including System F and System Fω.[20] This turned out to be possible because the types of encoded terms being reflected in the types of their representations prevents constructing a diagonal argument. In their paper, Brown and Palsberg claim to disprove the "conventional wisdom" that self-interpretation is impossible (and they refer to Wikipedia as an example of the conventional wisdom), but what they actually disprove is the impossibility of self-recognizers, a distinct concept. In their follow-up work, they switch to the more specific "self-recognizer" terminology used here, notably distinguishing these from "self-evaluators", of type .[21] They also recognize that implementing self-evaluation seems harder than self-recognition, and leave the implementation of the former in a strongly-normalizing language as an open problem.

Uses

[edit]

In combination with an existing language implementation, meta-circular interpreters provide a baseline system from which to extend a language, either upwards by adding more features or downwards by compiling away features rather than interpreting them.[22] They are also useful for writing tools that are tightly integrated with the programming language, such as sophisticated debuggers.[citation needed] A language designed with a meta-circular implementation in mind is often more suited for building languages in general, even ones completely different from the host language.[citation needed]

Examples

[edit]

Many languages have one or more meta-circular implementations. Here below is a partial list.

Some languages with a meta-circular implementation designed from the bottom up, in grouped chronological order:

Some languages with a meta-circular implementation via third parties:

See also

[edit]

References

[edit]
  1. ^ a b c d e Reynolds, John C. (1972). "Definitional Interpreters for Higher-Order Programming Languages". Proceedings of the ACM annual conference on - ACM '72 (PDF). Vol. 2. Proceedings of 25th ACM National Conference. pp. 717–740. doi:10.1145/800194.805852. Retrieved 14 April 2017.
  2. ^ a b Reynolds, John C. (1998). "Definitional Interpreters Revisited" (PDF). Higher-Order and Symbolic Computation. 11 (4): 355–361. doi:10.1023/A:1010075320153. S2CID 34126862. Retrieved 21 March 2023.
  3. ^ a b Abelson, Harold; Sussman, Gerald; Sussman, Julie (1996) [First published 1984 (1st ed.)]. "The Metacircular Evaluator". Structure and Interpretation of Computer Programs. MIT. Archived from the original on 2025-08-07. Retrieved 2025-08-07.
  4. ^ B?hm, Corrado (1954). "Calculatrices digitales. Du déchiffrage des formules logico-mathématiques par la machine même dans la conception du programme". Ann. Mat. Pura Appl. 4 (37): 1–51.
  5. ^ Knuth, Donald E.; Pardo, Luis Trabb (August 1976). The early development of programming languages. p. 36.
  6. ^ McCarthy, John (1961). "A Universal LISP Function" (PDF). Lisp 1.5 Programmer's Manual. p. 10.
  7. ^ Harvey, Brian. "Why Structure and Interpretation of Computer Programs matters". people.eecs.berkeley.edu. Retrieved 14 April 2017.
  8. ^ Braithwaite, Reginald (2025-08-07). "The significance of the meta-circular interpreter". Retrieved 2025-08-07.
  9. ^ Danvy, Olivier (2006). An Analytical Approach to Programs as Data Objects (Thesis). doi:10.7146/aul.214.152. ISBN 9788775073948.
  10. ^ Strachey, Christopher (1967). Fundamental Concepts in Programming Languages (Technical report). doi:10.1023/A:1010000313106.
  11. ^ Mosses, Peter D. (2000). "A Foreword to 'Fundamental Concepts in Programming Languages'". Higher-Order and Symbolic Computation. 13 (1/2): 7–9. doi:10.1023/A:1010048229036. S2CID 39258759.
  12. ^ Plotkin, Gordon D. (1975). "Call by name, call by value and the lambda-calculus". Theoretical Computer Science. 1 (2): 125–159. doi:10.1016/0304-3975(75)90017-1.
  13. ^ Felleisen, Matthias; Friedman, Daniel (1986). Control Operators, the SECD Machine, and the lambda-Calculus (PDF). Formal Description of Programming Concepts III, Elsevier Science Publishers B.V. (North-Holland). pp. 193–217.
  14. ^ Schmidt, David A. (1980). "State transition machines for lambda-calculus expressions". State transition machines for lambda calculus expressions. Lecture Notes in Computer Science. Vol. 94. Semantics-Directed Compiler Generation, LNCS 94. pp. 415–440. doi:10.1007/3-540-10250-7_32. ISBN 978-3-540-10250-2.
  15. ^ Danvy, Olivier (2004). A Rational Deconstruction of Landin's SECD Machine (PDF). Implementation and Application of Functional Languages, 16th International Workshop, IFL 2004, Revised Selected Papers, Lecture Notes in Computer Science 3474, Springer. pp. 52–71. ISSN 0909-0878.
  16. ^ Ager, Mads Sig; Biernacki, Dariusz; Danvy, Olivier; Midtgaard, Jan (2003). "A Functional Correspondence between Evaluators and Abstract Machines". Brics Report Series. 10 (13). 5th International ACM SIGPLAN Conference on Principles and Practice of Declarative Programming (PPDP'03): 8–19. doi:10.7146/brics.v10i13.21783.
  17. ^ Riolo, Rick; Worzel, William P.; Kotanchek, Mark (4 June 2015). Genetic Programming Theory and Practice XII. Springer. p. 59. ISBN 978-3-319-16030-6. Retrieved 8 September 2021.
  18. ^ Conor McBride (May 2003), "on termination" (posted to the Haskell-Cafe mailing list).
  19. ^ Andrej Bauer (June 2014), Answer to: A total language that only a Turing complete language can interpret (posted to the Theoretical Computer Science StackExchange site)
  20. ^ Brown, Matt; Palsberg, Jens (11 January 2016). "Breaking through the normalization barrier: A self-interpreter for f-omega" (PDF). Proceedings of the 43rd Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages. pp. 5–17. doi:10.1145/2837614.2837623. ISBN 9781450335492. S2CID 14781370.
  21. ^ Brown, Matt; Palsberg, Jens (January 2017). "Typed self-evaluation via intensional type functions". Proceedings of the 44th ACM SIGPLAN Symposium on Principles of Programming Languages. pp. 415–428. doi:10.1145/3009837.3009853. ISBN 9781450346603.
  22. ^ Oriol, Manuel; Meyer, Bertrand (2025-08-07). Objects, Components, Models and Patterns: 47th International Conference, TOOLS EUROPE 2009, Zurich, Switzerland, June 29-July 3, 2009, Proceedings. Springer Science & Business Media. p. 330. ISBN 9783642025716. Retrieved 14 April 2017.
  23. ^ Meta-circular implementation of the Pico programming language
[edit]
猴配什么生肖最好 3月27是什么星座 专科是什么意思 子宫内膜异位症是什么意思 红枣什么时候吃最好
照是什么意思 abs材质是什么 什么是交感神经 好无奈是什么意思 七月与安生讲的是什么
纤维增殖灶是什么意思 大豆是什么 慢性非萎缩性胃炎什么意思 中暑了吃什么好 左边偏头痛什么原因
阳痿早泄挂什么科 皮肌炎是什么症状 山西有什么特产 为什么拔罐肩膀最黑 菊苣别名叫什么
喝枸杞有什么好处hcv8jop4ns0r.cn 头上长虱子什么原因引起的hcv8jop3ns6r.cn 守望相助是什么意思hcv9jop8ns1r.cn 心肌缺血做什么检查能查出来hcv8jop2ns3r.cn 月球上有什么adwl56.com
乘务长是干什么的hcv8jop2ns3r.cn 家庭主妇是什么意思hcv8jop6ns3r.cn 魁元是什么意思hcv9jop1ns6r.cn 天然呆是什么意思hcv9jop3ns3r.cn 男朋友过生日送什么礼物最有意义hcv8jop2ns1r.cn
96120是什么电话hcv8jop7ns5r.cn 怀孕打黄体酮针有什么作用hcv9jop7ns9r.cn 阴道发臭是什么原因hcv9jop6ns3r.cn 猫睡在枕头旁说明什么hcv9jop7ns1r.cn 汗斑用什么药hcv9jop0ns3r.cn
扁桃体炎吃什么药最好hcv8jop4ns2r.cn 月经期间喝什么比较好hcv8jop2ns6r.cn 长白眉毛是什么征兆hcv7jop4ns8r.cn mch是什么意思hcv8jop3ns2r.cn 食欲不振是什么原因hcv8jop7ns2r.cn
百度