什么东西补血| 促甲状腺素低是什么原因| 月经不正常吃什么药| 女生说6524是什么意思| 香五行属什么| 肌肉酸痛用什么膏药| b型血的人是什么性格| 少女怀春是什么意思| 舌头痛吃什么药好得快| 乌鸡白凤丸适合什么人吃| 绿豆芽炒什么好吃| 活检和穿刺有什么区别| 水痘长什么样| 外阴湿疹用什么药| 吃毛蛋有什么好处| joma是什么牌子| 九重紫纪咏结局是什么| 什么锤百炼| 为什么不| 喝中药不能吃什么东西| 懂事是什么意思| 10月10号是什么日子| 指鹿为马是什么生肖| 坚果都有什么| 右下眼皮跳是什么预兆| 灾煞是什么意思| 甲沟炎应该挂什么科| 缺铁吃什么| 月经不正常去医院检查什么项目| 月经不干净是什么原因| 反刍是什么意思| 脚底发凉是什么原因| 胃不消化吃什么药好| 什么是奶昔| 什么病不能吃丝瓜| 长期尿黄可能是什么病| 维生素d补什么| 炖大骨头放什么调料| 多饮多尿可能是什么病| 高血压不能吃什么水果| 打封闭针有什么坏处| 牛仔布料是什么面料| 20是什么生肖| 外阴白斑瘙痒抹什么药| 屈光不正什么意思| 肚脐右边按压疼是什么原因| 双是什么意思| 乳房痛挂什么科| 破伤风是什么症状| 篱笆是什么| 做梦怀孕了是什么意思| 右耳朵疼是什么原因| 宽字五行属什么| 90年出生属什么生肖| 血糖高是什么症状| 红豆是什么意思| 姜黄是什么| 苏州五行属什么| 眼睛怕光是什么原因| 胎毛是什么| pph是什么材料| 用苦良心是什么意思| 感冒扁桃体发炎吃什么药| 乳腺增生吃什么药效果好| 什么是阳虚| mra是什么意思| 淀粉是什么| 1977年是什么年| 绿得什么| 什么方法可以治打嗝| 头位是什么意思| 冲服是什么意思| 什么是电离辐射| 三原色是什么| 严重失眠挂什么科| 绿豆汤什么颜色| 鱼腥草有什么用处| 肝郁气滞是什么意思| 什么是甲减有什么症状| 胃灼热烧心吃什么药| 荡气回肠是什么意思| 表情是什么意思| 宜子痣是什么意思| 香菜炒什么好吃| 物理压榨油是什么意思| 做梦梦到老婆出轨是什么意思| 喝茶失眠是什么原因| absolue是兰蔻的什么产品| 人参泡酒有什么功效和作用| 淋巴净排是什么服务| 全身酸痛什么原因| 梦见煮饺子是什么意思| 听字五行属什么| 胎心不稳定是什么原因| 晞是什么意思| 放任是什么意思| 黑白颠倒是什么意思| tnt是什么意思| 疖肿用什么药膏| 外耳炎用什么药| 做眉毛有什么危害| hco3-是什么意思| 情绪是什么| 神经内科主要看什么| 什么是燕麦| 窦性心律逆钟向转位是什么意思| 心内科是看什么病的| 鱼漂什么牌子的好| 扑朔迷离是什么意思| 梦见煤气罐爆炸是什么意思| 424是什么意思| 君子兰有什么特点| 便秘吃什么药效果最好| 口加一笔变成什么字| 姐姐家的孩子叫什么| 腹泻吃什么药最有效| 菊花的功效是什么| 例假提前是什么原因| 花裤子配什么上衣| 不来月经是什么原因| 银杯子喝水有什么好处与坏处| 浑身没力气是什么原因| prime是什么意思| 反差萌是什么意思| 测怀孕的试纸叫什么| 着凉了吃什么药| 吃什么可以增强记忆力| 男性内分泌失调吃什么药| 肌红蛋白是什么意思| 走马观花的走是什么意思| 月忌日是什么意思| 杰五行属性是什么| 左侧头疼是什么原因| 维生素e的功效与作用是什么| 韩束适合什么年龄段的人用| 新陈代谢是什么| 什么是酒糟鼻| 朝拜的意思是什么| 酸菜鱼一般用什么鱼| dennis什么意思| 非典是什么病| 麻了是什么意思| 纪念什么意思| 什么芦荟可以直接擦脸| 中国最大的海是什么海| 经常打嗝是什么原因引起的| 有什么故事| sin是什么边比什么边| 山竹有什么功效和作用| 大便隐血弱阳性是什么意思| 元旦送老师什么礼物| 册那是什么意思| 人生得意须尽欢是什么意思| 长痘吃什么水果| 虚岁31岁属什么生肖| 精神可嘉是什么意思| 什么是爱呢| 晚上睡觉手麻是什么原因| c2是什么意思| 七月六号是什么星座| 蜘蛛属于什么类动物| 总三萜是什么| 兔和什么相冲| 超负荷是什么意思| 舌尖有点麻是什么原因| 桂枝是什么| 狮子座和什么座最配对| 灵枢是什么意思| 备孕为什么要吃叶酸| 心口痛挂什么科| 女人吃桑葚有什么好处| 扁桃体切除对身体有什么影响| 人乳头瘤病毒58型阳性是什么意思| 血稠有什么症状| 吃什么紧致皮肤抗衰老| 比目鱼是什么鱼| 低压是什么意思| 萩是什么意思| 63年属什么生肖| 生殖器疱疹是什么原因引起的| 脾虚湿盛吃什么药| 申的五行属什么| 江小白加雪碧什么意思| 猪油吃多了有什么好处和坏处| 单核细胞高是什么感染| 电话正在通话中是什么意思| 台风什么时候到上海| 5月31号是什么星座| 猫吐了吃什么药| 五月二十日是什么星座| sb是什么元素符号| 副师长是什么级别| 减肥期间吃什么| 什么时候初伏第一天| 李世民和武则天什么关系| 非特异性阴道炎是什么意思| 甲亢吃什么盐好| 双红出彩是什么生肖| 蛇吃什么食物| 脚酸臭是什么原因| 技校算什么学历| 7月17号什么星座| 穿刺是什么意思| 癣是什么原因引起的| 绿色心情是什么意思| 孕期腰疼是什么原因| 什么人容易得老年痴呆| 什么是三伏贴| 吃饭出汗是什么原因| 痔疮不治会有什么危害| 脚趾头抽筋是什么原因引起的| 亲嘴会传染什么病| 有始无终是什么生肖| zuczug是什么牌子| 造化是什么意思| 万什么一心| 报晓是什么意思| 甲亢可以吃什么水果| experiment是什么意思| 一个口一个麦念什么| 考药师证需要什么条件| 梦见怀孕是什么征兆| 刚需是什么意思| 什么的草原| 金开什么字| 甲状腺不均质改变是什么意思| 什么是渡劫| 心脏彩超挂什么科| 老年人血压忽高忽低是什么原因| 看指甲去医院挂什么科| 老是放屁什么原因| 狗哭了代表什么预兆| 梦见捡钱了是什么预兆| 什么是埋线减肥| 农历12月26日是什么星座| 举人相当于什么官| 西南方向五行属什么| 早上三点是什么时辰| 肝结节挂什么科| 痤疮用什么药治最好效果最快| urea是什么意思| 人为什么没有尾巴| 1990年1月属什么生肖| 解脲支原体阳性是什么病| 小狗拉稀 吃什么药| 猫头鹰属于什么科| 吃什么降血压的食物| 朋友过生日送什么好| 血脂高挂什么科| 脚底脱皮用什么药膏| 意有所指是什么意思| 健身吃什么水果| 气短是什么症状| 右眼睛跳是什么意思| 纸醉金迷下一句是什么| 甲基蓝治疗什么鱼病| 吃什么对身体好| 骨关节炎吃什么药| 这个故事告诉我们什么道理| 孔子名叫什么| 天蝎座和什么座最配| 什么情况不能献血| 头部爱出汗是什么原因| 阴唇肥大是什么原因| 百度Jump to content

公园里的“百老汇”(1)

From Wikipedia, the free encyclopedia
(Redirected from Bootstrap compiler)
百度   瓜子二手车直卖网官方表示,对此高度重视,立即停止该批次问题车辆在平台上的撮合,并终止正在进行的召回范围内的车辆的交易。

In computer science, bootstrapping is the technique for producing a self-compiling compiler – that is, a compiler (or assembler) written in the source programming language that it intends to compile. An initial core version of the compiler (the bootstrap compiler) is generated in a different language (which could be assembly language); successive expanded versions of the compiler are developed using this minimal subset of the language. The problem of compiling a self-compiling compiler has been called the chicken-or-egg problem in compiler design, and bootstrapping is a solution to this problem.[1][2]

Bootstrapping is a fairly common practice when creating a programming language. Many compilers for many programming languages are bootstrapped, including compilers for ALGOL, BASIC, C, Common Lisp, D, Eiffel, Elixir, Go, Haskell, Java, Modula-2, Nim, Oberon, OCaml, Pascal, PL/I, Python, Rust, Scala, Scheme, TypeScript, Vala, Zig and more.

Process

[edit]

A typical bootstrap process works in three or four stages:[3][4][5]

  • Stage 0: preparing an environment for the bootstrap compiler to work with. This is where the source language and output language of the bootstrap compiler are chosen. In the case of a "bare machine" (one which has no compiler for any language) the source and output are written as binary machine code, or may be created by cross compiling on some other machine than the target. Otherwise, the bootstrap compiler is to be written in one of the programming languages which does exist on the target machine, and that compiler will generate something which can execute on the target, including a high-level programming language, an assembly language, an object file, or even machine code.
  • Stage 1: the bootstrap compiler is produced. This compiler is enough to translate its own source into a program which can be executed on the target machine. At this point, all further development is done using the language defined by the bootstrap compiler, and stage 2 begins.
  • Stage 2: a full compiler is produced by the bootstrap compiler. This is typically done in stages as needed, e.g. compiler for version X of the language will be able to compile features from version X+1, but that compiler does not actually use those features. Once this compiler has been tested and can compile itself, now version X+1 features may be used by subsequent releases of the compiler.
  • Stage 3: a full compiler is produced by the stage 2 full compiler. If more features are to be added, work resumes at stage 2, with the current stage 3 full compiler replacing the bootstrap compiler.

The full compiler is built twice in order to compare the outputs of the two stages. If they are different, either the bootstrap or the full compiler contains a bug.[3]

Methods

[edit]

If one needs to compile a compiler for language X written in language X, there is the issue of how the first compiler can be compiled. The different methods that are used in practice include:

  • Implementing an interpreter or compiler for language X in language Y. Niklaus Wirth reported that he wrote the first Pascal compiler in Fortran.[6]
  • Another interpreter or compiler for X has already been written in another language Y; this is how Scheme is often bootstrapped.
  • Earlier versions of the compiler were written in a subset of X for which there existed some other compiler; this is how some supersets of Java, Haskell, and the initial Free Pascal compiler are bootstrapped.
  • A compiler supporting non-standard language extensions or optional language features can be written without using those extensions and features, to enable it being compiled with another compiler supporting the same base language but a different set of extensions and features. The main parts of the C++ compiler clang were written in a subset of C++ that can be compiled by both g++ and Microsoft Visual C++. Advanced features are written with some GCC extensions.
  • The compiler for X is cross compiled from another architecture where there exists a compiler for X; this is how compilers for C are usually ported to other platforms. Also this is the method used for Free Pascal after the initial bootstrap.
  • Writing the compiler in X; then hand-compiling it from source (most likely in a non-optimized way) and running that on the code to get an optimized compiler. Donald Knuth used this for his WEB literate programming system.

Methods for distributing compilers in source code include providing a portable bytecode version of the compiler, so as to bootstrap the process of compiling the compiler with itself. The T-diagram is a notation used to explain these compiler bootstrap techniques.[7] In some cases, the most convenient way to get a complicated compiler running on a system that has little or no software on it involves a series of ever more sophisticated assemblers and compilers.[8]

History

[edit]

Assemblers were the first language tools to bootstrap themselves.

The first high-level language to provide such a bootstrap was NELIAC in 1958. The first widely used languages to do so were Burroughs B5000 Algol in 1961 and LISP in 1962.

Hart and Levin wrote a LISP compiler in LISP at MIT in 1962, testing it inside an existing LISP interpreter. Once they had improved the compiler to the point where it could compile its own source code, it was self-hosting.[9]

The compiler as it exists on the standard compiler tape is a machine language program that was obtained by having the S-expression definition of the compiler work on itself through the interpreter.

—?AI Memo 39[9]

This technique is only possible when an interpreter already exists for the very same language that is to be compiled. It borrows directly from the notion of running a program on itself as input, which is also used in various proofs in theoretical computer science, such as the variation of the proof that the halting problem is undecidable that uses Rice's Theorem.

Current efforts

[edit]

Due to security concerns regarding the Trusting Trust Attack (which involves a compiler being maliciously modified to introduce covert backdoors in programs it compiles or even further replicate the malicious modification in future versions of the compiler itself, creating a perpetual cycle of distrust) and various attacks against binary trustworthiness, multiple projects are working to reduce the effort for not only bootstrapping from source but also allowing everyone to verify that source and executable correspond. These include the Bootstrappable builds project[10] and the Reproducible builds project.[11]

See also

[edit]

References

[edit]
  1. ^ Reynolds, John H. (December 2003). "Bootstrapping a self-compiling compiler from machine X to machine Y". CCSC: Eastern Conference. Journal of Computing Sciences in Colleges. 19 (2): 175–181. The idea of a compiler written in the language it compiles stirs up the old 'chicken-or-the-egg' conundrum: Where does the first one come from?
  2. ^ Glück, Robert (2012). "Bootstrapping compiler generators from partial evaluators". In Clarke, Edmund; Virbitskaite, Irina; Voronkov, Andrei (eds.). Perspectives of Systems Informatics: 8th International Andrei Ershov Memorial Conference, PSI 2011, Novosibirsk, Russia, June 27 – July 1, 2011, Revised Selected Papers. Lecture Notes in Computer Science. Vol. 7162. Springer. pp. 125–141. doi:10.1007/978-3-642-29709-0_13. ISBN 978-3-642-29708-3. Getting started presents the chicken-and-egg problem familiar from compiler construction: one needs a compiler to bootstrap a compiler, and bootstrapping compiler generators is no exception.
  3. ^ a b "Installing GCC: Building". GNU Project - Free Software Foundation (FSF).
  4. ^ "rust-lang/rust: bootstrap". GitHub.
  5. ^ "Advanced Build Configurations — LLVM 10 documentation". llvm.org.
  6. ^ Wirth, Niklaus (2025-08-06). "50 years of Pascal". Communications of the ACM. 64 (3). Association for Computing Machinery (ACM): 39–41. doi:10.1145/3447525. ISSN 0001-0782. S2CID 231991096.
  7. ^ Patrick D. Terry (1997). "3. Compiler Construction and Bootstrapping". Compilers and Compiler Generators: An Introduction With C++. International Thomson Computer Press. ISBN 1-85032-298-8. Archived from the original on 2025-08-06.
  8. ^ Edmund Grimley-Evans (2025-08-06). "Bootstrapping a simple compiler from nothing". homepage.ntlworld.com. Archived from the original on 2025-08-06.
  9. ^ a b Tim Hart and Mike Levin. "AI Memo 39-The new compiler" (PDF). Archived from the original (PDF) on 2025-08-06. Retrieved 2025-08-06.
  10. ^ "Bootstrappable builds". bootstrappable.org.
  11. ^ "Reproducible Builds — a set of software development practices that create an independently-verifiable path from source to binary code". reproducible-builds.org.
斯里兰卡属于什么国家 护士还能从事什么工作 子宫长什么样 头发长不长是什么原因怎么办 青春痘用什么药膏擦最好呢
除外是什么意思 天可以加什么偏旁 一什么叮咛 什么坚果适合减肥吃 淋巴滤泡增生吃什么药
马什么梅 优势是什么意思 上火牙齿痛吃什么药 淋巴系统由什么组成 红茶什么季节喝最好
天降横财什么意思 头疼是因为什么 济南为什么叫泉城 周武王叫什么名字 护理假是什么意思
烧仙草是什么植物hcv9jop0ns7r.cn 智齿是什么hcv7jop6ns2r.cn 鸡婆是什么意思hcv9jop2ns4r.cn 儿童过敏性鼻炎吃什么药好hcv9jop4ns6r.cn 处方药是什么意思onlinewuye.com
气虚是什么意思hcv8jop4ns2r.cn 尿蛋白高有什么危害hcv9jop6ns8r.cn 扁桃是什么水果hcv8jop6ns7r.cn 博士在古代是什么意思hcv7jop9ns2r.cn 为什么发烧会觉得冷hcv9jop3ns4r.cn
尿酸高早餐吃什么hcv7jop6ns6r.cn 肠胃炎需要做什么检查hcv8jop4ns4r.cn 右加一笔是什么字hcv7jop7ns3r.cn 哆啦a梦大结局是什么hcv8jop1ns2r.cn 马冬梅是什么梗xjhesheng.com
光棍一条是什么生肖hcv8jop7ns1r.cn 颞下颌紊乱挂什么科hcv7jop5ns4r.cn 藕粉不能和什么一起吃hcv7jop7ns0r.cn 睡觉起来脸肿是什么原因引起的hcv8jop7ns0r.cn 糖尿病人吃什么水果最好hcv9jop4ns8r.cn
百度