The design of a space efficient compiler

SIGMINI '78 Pub Date : 1978-04-01 DOI:10.1145/800218.806634
M. K. Donegan
{"title":"The design of a space efficient compiler","authors":"M. K. Donegan","doi":"10.1145/800218.806634","DOIUrl":null,"url":null,"abstract":"Writing a compiler for a small machine with minimal software support can be quite difficult because the program is long and debugging aids are usually inadequate. In addition, the usual techniques for compiler writing tend to produce programs which are quite large when compared to, for example, a BASIC interpreter. This frustrates efforts for producing compilers on small machines. We describe a method which can be used to reduce the size of a compiler and simultaneously provide good debugging tools. The resulting compiler sacrifices little in terms of execution speed (in part because compilers on minicomputers are often I/O bound). We have used this method to write an MPL [1] compiler for a Microdata 32/S minicomputer. The compiler requires approximately 12K bytes of memory as opposed to 32K bytes required by the compiler produced by the manufacturer, and compiles at essentially the same speed. Appendix II outlines the syntax of the MPL language and is included to illustrate the size of the language being compiled. MPL is based on PL/I and is quite similar to the PL/M* [2] language developed by the INTEL Corporation.\n The method described here uses an interpretive language for writing the compiler. Thus the interpreter is the only machine language program written. We coded the interpreter in MPL and used a cross compiler to compile it, however, the interpreter could have been easily coded in assembly language. Figure 1 illustrates the savings of the interpretive language over machine code. The procedure IF_STAT is typical of a routine which might appear in a recursive descent compiler for MPL. The gain in space occurs because machine language instructions carry too much information content when applied to a special purpose (such as compiling). Note for example that a subroutine call for the Microdata requires 6 bytes, but all that is really needed is an opcode to indicate a call and a byte to indicate which of a few subroutines is to be called.","PeriodicalId":344026,"journal":{"name":"SIGMINI '78","volume":"26 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"1978-04-01","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"1","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"SIGMINI '78","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1145/800218.806634","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 1

Abstract

Writing a compiler for a small machine with minimal software support can be quite difficult because the program is long and debugging aids are usually inadequate. In addition, the usual techniques for compiler writing tend to produce programs which are quite large when compared to, for example, a BASIC interpreter. This frustrates efforts for producing compilers on small machines. We describe a method which can be used to reduce the size of a compiler and simultaneously provide good debugging tools. The resulting compiler sacrifices little in terms of execution speed (in part because compilers on minicomputers are often I/O bound). We have used this method to write an MPL [1] compiler for a Microdata 32/S minicomputer. The compiler requires approximately 12K bytes of memory as opposed to 32K bytes required by the compiler produced by the manufacturer, and compiles at essentially the same speed. Appendix II outlines the syntax of the MPL language and is included to illustrate the size of the language being compiled. MPL is based on PL/I and is quite similar to the PL/M* [2] language developed by the INTEL Corporation. The method described here uses an interpretive language for writing the compiler. Thus the interpreter is the only machine language program written. We coded the interpreter in MPL and used a cross compiler to compile it, however, the interpreter could have been easily coded in assembly language. Figure 1 illustrates the savings of the interpretive language over machine code. The procedure IF_STAT is typical of a routine which might appear in a recursive descent compiler for MPL. The gain in space occurs because machine language instructions carry too much information content when applied to a special purpose (such as compiling). Note for example that a subroutine call for the Microdata requires 6 bytes, but all that is really needed is an opcode to indicate a call and a byte to indicate which of a few subroutines is to be called.
空间高效编译器的设计
为具有最少软件支持的小型机器编写编译器可能相当困难,因为程序很长,而且调试辅助工具通常不足。此外,通常编写编译器的技术往往会产生与(例如)BASIC解释器相比相当大的程序。这阻碍了在小型机器上生成编译器的努力。我们描述了一种方法,可以用来减少编译器的大小,同时提供良好的调试工具。由此产生的编译器在执行速度方面几乎没有牺牲(部分原因是小型计算机上的编译器通常是I/O受限的)。我们用这种方法为Microdata 32/S小型计算机编写了MPL[1]编译器。编译器需要大约12K字节的内存,而制造商生产的编译器需要32K字节,并且编译的速度基本相同。附录II概述了MPL语言的语法,并说明了正在编译的语言的大小。MPL基于PL/I,与INTEL公司开发的PL/M*[2]语言非常相似。这里描述的方法使用解释性语言来编写编译器。因此,解释器是唯一编写的机器语言程序。我们用MPL编写解释器,并使用交叉编译器来编译它,然而,解释器可以很容易地用汇编语言编写。图1说明了解释性语言相对于机器代码的节省。过程IF_STAT是典型的例程,可能出现在MPL的递归下降编译器中。空间的增加是因为机器语言指令在用于特殊目的(如编译)时携带了太多的信息内容。例如,请注意,对Microdata的子例程调用需要6个字节,但真正需要的只是指示调用的操作码和指示要调用的子例程中的哪一个的字节。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
求助全文
约1分钟内获得全文 求助全文
来源期刊
自引率
0.00%
发文量
0
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
确定
请完成安全验证×
copy
已复制链接
快去分享给好友吧!
我知道了
右上角分享
点击右上角分享
0
联系我们:info@booksci.cn Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。 Copyright © 2023 布克学术 All rights reserved.
京ICP备2023020795号-1
ghs 京公网安备 11010802042870号
Book学术文献互助
Book学术文献互助群
群 号:604180095
Book学术官方微信