首页 > 最新文献

Scheme and Functional Programming最新文献

英文 中文
miniKanren, live and untagged: quine generation via relational interpreters (programming pearl) miniKanren, live和untagged:通过关系解释器生成quine (programming pearl)
Pub Date : 2012-09-09 DOI: 10.1145/2661103.2661105
William E. Byrd, Eric Holk, Daniel P. Friedman
We present relational interpreters for several subsets of Scheme, written in the pure logic programming language miniKanren. We demonstrate these interpreters running "backwards"---that is, generating programs that evaluate to a specified value---and show how the interpreters can trivially generate quines (programs that evaluate to themselves). We demonstrate how to transform environment-passing interpreters written in Scheme into relational interpreters written in miniKanren. We show how constraint extensions to core miniKanren can be used to allow shadowing of the interpreter's primitive forms (using the absent° tree constraint), and to avoid having to tag expressions in the languages being interpreted (using disequality constraints and symbol/number type-constraints), simplifying the interpreters and eliminating the need for parsers/unparsers. We provide four appendices to make the code in the paper completely self-contained. Three of these appendices contain new code: the complete implementation of core miniKanren extended with the new constraints; an extended relational interpreter capable of running factorial and doing list processing; and a simple pattern matcher that uses Dijkstra guards. The other appendix presents our preferred version of code that has been presented elsewhere: the miniKanren relational arithmetic system used in the extended interpreter.
我们用纯逻辑编程语言miniKanren编写了Scheme的几个子集的关系解释器。我们演示了这些解释器“向后”运行——即生成求值为指定值的程序——并展示了解释器如何简单地生成队列(对自己求值的程序)。我们演示了如何将用Scheme编写的环境传递解释器转换为用miniKanren编写的关系解释器。我们展示了如何使用对核心miniKanren的约束扩展来允许隐藏解释器的原始形式(使用缺席树约束),并避免在被解释的语言中标记表达式(使用不等式约束和符号/数字类型约束),简化解释器并消除对解析器/解析器的需求。我们提供了四个附录,使论文中的代码完全独立。其中三个附录包含新的代码:扩展了新约束的核心miniKanren的完整实现;一个扩展的关系解释器,能够运行阶乘和做列表处理;以及使用Dijkstra守卫的简单模式匹配器。另一个附录介绍了我们在其他地方介绍过的首选代码版本:扩展解释器中使用的miniKanren关系算术系统。
{"title":"miniKanren, live and untagged: quine generation via relational interpreters (programming pearl)","authors":"William E. Byrd, Eric Holk, Daniel P. Friedman","doi":"10.1145/2661103.2661105","DOIUrl":"https://doi.org/10.1145/2661103.2661105","url":null,"abstract":"We present relational interpreters for several subsets of Scheme, written in the pure logic programming language miniKanren. We demonstrate these interpreters running \"backwards\"---that is, generating programs that evaluate to a specified value---and show how the interpreters can trivially generate quines (programs that evaluate to themselves). We demonstrate how to transform environment-passing interpreters written in Scheme into relational interpreters written in miniKanren. We show how constraint extensions to core miniKanren can be used to allow shadowing of the interpreter's primitive forms (using the absent° tree constraint), and to avoid having to tag expressions in the languages being interpreted (using disequality constraints and symbol/number type-constraints), simplifying the interpreters and eliminating the need for parsers/unparsers.\u0000 We provide four appendices to make the code in the paper completely self-contained. Three of these appendices contain new code: the complete implementation of core miniKanren extended with the new constraints; an extended relational interpreter capable of running factorial and doing list processing; and a simple pattern matcher that uses Dijkstra guards. The other appendix presents our preferred version of code that has been presented elsewhere: the miniKanren relational arithmetic system used in the extended interpreter.","PeriodicalId":113092,"journal":{"name":"Scheme and Functional Programming","volume":"5 1","pages":"0"},"PeriodicalIF":0.0,"publicationDate":"2012-09-09","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"115352029","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
引用次数: 39
A sufficiently smart compiler for procedural records 用于过程记录的足够智能的编译器
Pub Date : 2012-09-09 DOI: 10.1145/2661103.2661107
Andrew W. Keep, R. Dybvig
Many languages include a syntax for declaring programmer-defined structured data types, i.e., structs or records. R6RS supports syntactic record definitions but also allows records to be defined procedurally, i.e., via a set of run-time operations. Indeed, the procedural interface is considered to be the primitive interface, and the syntactic interface is designed to be macro expandable into code that uses the procedural interface. Run-time creation of record types has a potentially significant impact. In particular, record creation, field access, and field mutation cannot generally be open coded, as it can be with syntactically specified records. Often, however, the shape of a record type can be determined statically, and in such a case, performance equivalent to that of syntactically specified record types can be attained. This paper describes an efficient run-time implementation of procedural record types, discusses its overhead, and describes a set of compiler optimizations that eliminate the overhead when record-type information can be determined statically. The optimizations improve the performance of a set of representative benchmark programs by over 20% on average.
许多语言都包含用于声明程序员定义的结构化数据类型(即结构体或记录)的语法。R6RS支持语法记录定义,但也允许按过程定义记录,即通过一组运行时操作。实际上,过程接口被认为是基元接口,语法接口被设计成可以宏扩展到使用过程接口的代码中。记录类型的运行时创建具有潜在的重大影响。特别是,记录创建、字段访问和字段变更通常不能是开放编码的,因为可以使用语法指定的记录。但是,记录类型的形状通常可以静态地确定,在这种情况下,可以获得与语法指定的记录类型相当的性能。本文描述了过程记录类型的一个有效的运行时实现,讨论了它的开销,并描述了一组编译器优化,当记录类型信息可以静态确定时,这些优化可以消除开销。这些优化将一组有代表性的基准程序的性能平均提高了20%以上。
{"title":"A sufficiently smart compiler for procedural records","authors":"Andrew W. Keep, R. Dybvig","doi":"10.1145/2661103.2661107","DOIUrl":"https://doi.org/10.1145/2661103.2661107","url":null,"abstract":"Many languages include a syntax for declaring programmer-defined structured data types, i.e., structs or records. R6RS supports syntactic record definitions but also allows records to be defined procedurally, i.e., via a set of run-time operations. Indeed, the procedural interface is considered to be the primitive interface, and the syntactic interface is designed to be macro expandable into code that uses the procedural interface. Run-time creation of record types has a potentially significant impact. In particular, record creation, field access, and field mutation cannot generally be open coded, as it can be with syntactically specified records. Often, however, the shape of a record type can be determined statically, and in such a case, performance equivalent to that of syntactically specified record types can be attained. This paper describes an efficient run-time implementation of procedural record types, discusses its overhead, and describes a set of compiler optimizations that eliminate the overhead when record-type information can be determined statically. The optimizations improve the performance of a set of representative benchmark programs by over 20% on average.","PeriodicalId":113092,"journal":{"name":"Scheme and Functional Programming","volume":"57 1","pages":"0"},"PeriodicalIF":0.0,"publicationDate":"2012-09-09","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"132705779","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
引用次数: 4
Efficient compilation of tail calls and continuations to JavaScript 有效地编译尾部调用和JavaScript的延续
Pub Date : 2012-09-09 DOI: 10.1145/2661103.2661108
Eric Thivierge, M. Feeley
This paper describes an approach for compiling Scheme's tail calls and first-class continuations to JavaScript, a dynamic language without those features. Our approach is based on the use of a simple custom virtual machine intermediate representation that is translated to JavaScript. We compare this approach, which is used by the Gambit-JS compiler, to the Replay-C algorithm, used by Scheme2JS (a derivative of Bigloo), and Cheney on the MTA, used by Spock (a derivative of Chicken). We analyse the performance of the three systems with a set of benchmark programs on recent versions of four popular JavaScript VMs (V8, SpiderMonkey, Nitro and Chakra). On the benchmark programs, all systems perform best when executed with V8 and our approach is consistently faster than the others on all VMs. For some VMs and benchmarks our approach is moderately faster than the others (below a factor of 2), but in some cases there is a very large performance gap (with Nitro there is a slowdown of up to 3 orders of magnitude for Scheme2JS, and up to 2 orders of magnitude for Spock).
本文描述了一种将Scheme的尾部调用和一级延续编译到JavaScript的方法,JavaScript是一种没有这些特性的动态语言。我们的方法是基于使用一个简单的自定义虚拟机中间表示,它被翻译成JavaScript。我们将Gambit-JS编译器使用的这种方法与Scheme2JS (Bigloo的衍生物)和MTA上的Cheney (Spock (Chicken的衍生物))使用的Replay-C算法进行比较。我们在四个流行的JavaScript虚拟机(V8, SpiderMonkey, Nitro和Chakra)的最新版本上使用一组基准程序分析了这三个系统的性能。在基准测试程序中,所有系统在使用V8时都表现最佳,并且我们的方法在所有vm上始终比其他方法更快。对于一些虚拟机和基准测试,我们的方法比其他方法要快一些(低于2倍),但在某些情况下,性能差距非常大(使用Nitro时,Scheme2JS的速度下降了3个数量级,而Spock的速度下降了2个数量级)。
{"title":"Efficient compilation of tail calls and continuations to JavaScript","authors":"Eric Thivierge, M. Feeley","doi":"10.1145/2661103.2661108","DOIUrl":"https://doi.org/10.1145/2661103.2661108","url":null,"abstract":"This paper describes an approach for compiling Scheme's tail calls and first-class continuations to JavaScript, a dynamic language without those features. Our approach is based on the use of a simple custom virtual machine intermediate representation that is translated to JavaScript. We compare this approach, which is used by the Gambit-JS compiler, to the Replay-C algorithm, used by Scheme2JS (a derivative of Bigloo), and Cheney on the MTA, used by Spock (a derivative of Chicken). We analyse the performance of the three systems with a set of benchmark programs on recent versions of four popular JavaScript VMs (V8, SpiderMonkey, Nitro and Chakra). On the benchmark programs, all systems perform best when executed with V8 and our approach is consistently faster than the others on all VMs. For some VMs and benchmarks our approach is moderately faster than the others (below a factor of 2), but in some cases there is a very large performance gap (with Nitro there is a slowdown of up to 3 orders of magnitude for Scheme2JS, and up to 2 orders of magnitude for Spock).","PeriodicalId":113092,"journal":{"name":"Scheme and Functional Programming","volume":"41 Suppl 1 1","pages":"0"},"PeriodicalIF":0.0,"publicationDate":"2012-09-09","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"116374741","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
引用次数: 3
Interpretations of the gradually-typed lambda calculus 渐进式λ演算的解释
Pub Date : 2012-09-09 DOI: 10.1145/2661103.2661112
Jeremy G. Siek, Ronald Garcia
Gradual typing is an approach to integrating static and dynamic type checking within the same language [Siek and Taha 2006]. Given the name "gradual typing", one might think that the most interesting aspect is the type system. It turns out that the dynamic semantics of gradually-typed languages is more complex than the static semantics, with many points in the design space [Wadler and Findler 2009; Siek et al. 2009] and many challenges concerning efficiency [Herman et al. 2007; Hansen 2007; Siek and Taha 2007; Siek and Wadler 2010; Wrigstad et al. 2010; Rastogi et al. 2012]. In this distilled tutorial, we explore the meaning of gradual typing and the challenges to efficient implementation by writing several definitional interpreters and abstract machines in Scheme for the gradually-typed lambda calculus.
渐进式类型是一种在同一语言中集成静态和动态类型检查的方法[Siek和Taha 2006]。考虑到“渐进式类型”这个名字,人们可能会认为最有趣的方面是类型系统。事实证明,渐进类型语言的动态语义比静态语义更复杂,在设计空间中有许多点[Wadler and Findler 2009;Siek et al. 2009]和许多关于效率的挑战[Herman et al. 2007;汉森2007;Siek and Taha 2007;Siek and Wadler 2010;Wrigstad et al. 2010;Rastogi et al. 2012]。在这篇经过提炼的教程中,我们将探讨渐进式类型的含义,并通过在Scheme中为渐进式lambda演算编写几个定义解释器和抽象机器来探索有效实现的挑战。
{"title":"Interpretations of the gradually-typed lambda calculus","authors":"Jeremy G. Siek, Ronald Garcia","doi":"10.1145/2661103.2661112","DOIUrl":"https://doi.org/10.1145/2661103.2661112","url":null,"abstract":"Gradual typing is an approach to integrating static and dynamic type checking within the same language [Siek and Taha 2006]. Given the name \"gradual typing\", one might think that the most interesting aspect is the type system. It turns out that the dynamic semantics of gradually-typed languages is more complex than the static semantics, with many points in the design space [Wadler and Findler 2009; Siek et al. 2009] and many challenges concerning efficiency [Herman et al. 2007; Hansen 2007; Siek and Taha 2007; Siek and Wadler 2010; Wrigstad et al. 2010; Rastogi et al. 2012]. In this distilled tutorial, we explore the meaning of gradual typing and the challenges to efficient implementation by writing several definitional interpreters and abstract machines in Scheme for the gradually-typed lambda calculus.","PeriodicalId":113092,"journal":{"name":"Scheme and Functional Programming","volume":"30 1","pages":"0"},"PeriodicalIF":0.0,"publicationDate":"2012-09-09","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"123086268","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
引用次数: 21
Using scheme to control simulated modular robots 采用该方案对仿真模块化机器人进行控制
Pub Date : 2012-09-09 DOI: 10.1145/2661103.2661114
U. Schultz
Self-reconfigurable, modular robots are distributed mechatronic devices that can change their physical shape; modules are programmed individually but must coordinate across the robot. Programming modular robots is difficult due to the complexity of programming a distributed embedded system with a dynamically evolving topology. We are currently experimenting with programming-language abstractions to help overcome these difficulties. This tutorial describes a few such experiments using Scheme to control simulated modular robots.
自重构、模块化的机器人是分布式的机电一体化设备,可以改变其物理形状;模块是单独编程的,但必须在机器人之间协调。由于对具有动态演化拓扑结构的分布式嵌入式系统进行编程的复杂性,模块化机器人的编程非常困难。我们目前正在尝试用编程语言抽象来帮助克服这些困难。本教程描述了一些使用Scheme来控制模拟模块化机器人的实验。
{"title":"Using scheme to control simulated modular robots","authors":"U. Schultz","doi":"10.1145/2661103.2661114","DOIUrl":"https://doi.org/10.1145/2661103.2661114","url":null,"abstract":"Self-reconfigurable, modular robots are distributed mechatronic devices that can change their physical shape; modules are programmed individually but must coordinate across the robot. Programming modular robots is difficult due to the complexity of programming a distributed embedded system with a dynamically evolving topology. We are currently experimenting with programming-language abstractions to help overcome these difficulties. This tutorial describes a few such experiments using Scheme to control simulated modular robots.","PeriodicalId":113092,"journal":{"name":"Scheme and Functional Programming","volume":"170 1","pages":"0"},"PeriodicalIF":0.0,"publicationDate":"2012-09-09","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"131726570","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
引用次数: 2
Form over function: teaching beginners how to construct programs 形式重于功能:教初学者如何构造程序
Pub Date : 2012-09-09 DOI: 10.1145/2661103.2661113
Michael Sperber, Marcus Crestani
Teaching beginners how to program is hard: As knowledge about systematic construction of programs is quite young, knowledge about the didactics of the discipline is even younger and correspondingly incomplete. Developing and refining an introductory-programming course for more than a decade, we have learned that designing a successful course is a comprehensive activity and teachers should consider and question all aspects of a course. We doubt reports of sweeping successes in introductory-programming classes by the use of just one single didactic device---including claims that "switching to Scheme" magically turns a bad course into a good one. Of course, the choice of individual devices (including the use of Scheme) does matter, but for teaching an effective course the whole package counts. This paper describes the basic ideas and insights that have driven the development of our introductory course. In particular, a number of conclusions about effective teaching were not as we had originally expected.
教初学者如何编程是困难的:由于关于程序系统构造的知识相当年轻,关于该学科教学的知识更年轻,相应的也不完整。经过十多年的编程入门课程的开发和完善,我们了解到设计一门成功的课程是一项全面的活动,教师应该考虑和质疑课程的各个方面。我们怀疑仅仅使用一种教学手段就能在编程入门课上取得巨大成功的报道——包括声称“切换到Scheme”能神奇地把一个糟糕的课程变成一个好的课程。当然,个别设备的选择(包括Scheme的使用)确实很重要,但要教一个有效的课程,整套设备都很重要。本文描述了推动我们的入门课程发展的基本思想和见解。特别是,一些关于有效教学的结论与我们最初预期的不同。
{"title":"Form over function: teaching beginners how to construct programs","authors":"Michael Sperber, Marcus Crestani","doi":"10.1145/2661103.2661113","DOIUrl":"https://doi.org/10.1145/2661103.2661113","url":null,"abstract":"Teaching beginners how to program is hard: As knowledge about systematic construction of programs is quite young, knowledge about the didactics of the discipline is even younger and correspondingly incomplete. Developing and refining an introductory-programming course for more than a decade, we have learned that designing a successful course is a comprehensive activity and teachers should consider and question all aspects of a course. We doubt reports of sweeping successes in introductory-programming classes by the use of just one single didactic device---including claims that \"switching to Scheme\" magically turns a bad course into a good one. Of course, the choice of individual devices (including the use of Scheme) does matter, but for teaching an effective course the whole package counts. This paper describes the basic ideas and insights that have driven the development of our introductory course. In particular, a number of conclusions about effective teaching were not as we had originally expected.","PeriodicalId":113092,"journal":{"name":"Scheme and Functional Programming","volume":"18 1","pages":"0"},"PeriodicalIF":0.0,"publicationDate":"2012-09-09","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"131919445","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
引用次数: 6
Scheme on the web and in the classroom: a retrospective about the LAML project 网络和课堂上的方案:LAML项目回顾
Pub Date : 2012-09-09 DOI: 10.1145/2661103.2661104
K. Nørmark
LAML is a software system that brings XML languages into Scheme as a collection of Scheme functions. The XML languages are defined by XML document type definitions (DTDs). We review the development of LAML during more than a decade, and we collect the experiences from these efforts. The paper describes four substantial applications that have been developed on top of the LAML libraries.
LAML是一个将XML语言作为Scheme函数集合引入Scheme的软件系统。XML语言由XML文档类型定义(dtd)定义。我们回顾了LAML十多年来的发展,并从这些努力中收集了经验。本文描述了在LAML库之上开发的四个实际应用程序。
{"title":"Scheme on the web and in the classroom: a retrospective about the LAML project","authors":"K. Nørmark","doi":"10.1145/2661103.2661104","DOIUrl":"https://doi.org/10.1145/2661103.2661104","url":null,"abstract":"LAML is a software system that brings XML languages into Scheme as a collection of Scheme functions. The XML languages are defined by XML document type definitions (DTDs). We review the development of LAML during more than a decade, and we collect the experiences from these efforts. The paper describes four substantial applications that have been developed on top of the LAML libraries.","PeriodicalId":113092,"journal":{"name":"Scheme and Functional Programming","volume":"40 1","pages":"0"},"PeriodicalIF":0.0,"publicationDate":"2012-09-09","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"123247440","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
引用次数: 0
Hygienic quasiquotation in scheme 方案卫生准报价
Pub Date : 2012-09-09 DOI: 10.1145/2661103.2661109
Morten Rhiger
Quasiquotation in Scheme is nearly ideal for implementing programs that generate other programs. These programs lack only the ability to generate fresh bound identifiers, as required to make such code-manipulating programs hygienic, but any Scheme programmer knows how to provide this ability using gensym. In this tutorial we investigate hygienic quasiquotation in Scheme and in languages influenced by Scheme. Stepping back from implementation issues, we first identify the source of the freshness condition in the semantics of a hygienic quasiquotation facility. We then show how gensym is needed to break a meta-circularity in interpreters and compilers for hygienic quasiquotation. Finally, following our recent work, we present a type system for hygienic quasiquotation that supports evaluation under dynamic λ-abstraction, manipulation of open code, a first-class eval function, and mutable state. This tutorial outlines Scheme programs implementing an interpreter, a compiler, and a macro for hygienic quasiquotation.
Scheme中的拟引用对于实现生成其他程序的程序来说几乎是理想的。这些程序只缺乏生成新的绑定标识符的能力,而生成绑定标识符是使此类代码操作程序卫生所必需的,但是任何Scheme程序员都知道如何使用gensym提供这种能力。在本教程中,我们研究Scheme和受Scheme影响的语言中的卫生准引用。从实施问题退一步,我们首先在卫生准报价设施的语义中确定新鲜度条件的来源。然后,我们展示了如何需要gensym来打破解释器和编译器中卫生准引用的元循环。最后,根据我们最近的工作,我们提出了一个卫生的准引用类型系统,它支持动态抽象下的求值、对开放代码的操作、一级eval函数和可变状态。本教程概述了实现解释器、编译器和卫生准引用宏的Scheme程序。
{"title":"Hygienic quasiquotation in scheme","authors":"Morten Rhiger","doi":"10.1145/2661103.2661109","DOIUrl":"https://doi.org/10.1145/2661103.2661109","url":null,"abstract":"Quasiquotation in Scheme is nearly ideal for implementing programs that generate other programs. These programs lack only the ability to generate fresh bound identifiers, as required to make such code-manipulating programs hygienic, but any Scheme programmer knows how to provide this ability using gensym. In this tutorial we investigate hygienic quasiquotation in Scheme and in languages influenced by Scheme. Stepping back from implementation issues, we first identify the source of the freshness condition in the semantics of a hygienic quasiquotation facility. We then show how gensym is needed to break a meta-circularity in interpreters and compilers for hygienic quasiquotation. Finally, following our recent work, we present a type system for hygienic quasiquotation that supports evaluation under dynamic λ-abstraction, manipulation of open code, a first-class eval function, and mutable state. This tutorial outlines Scheme programs implementing an interpreter, a compiler, and a macro for hygienic quasiquotation.","PeriodicalId":113092,"journal":{"name":"Scheme and Functional Programming","volume":"22 1","pages":"0"},"PeriodicalIF":0.0,"publicationDate":"2012-09-09","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"123839941","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
引用次数: 3
Optimizing JavaScript code for V8 为V8优化JavaScript代码
Pub Date : 2012-09-09 DOI: 10.1145/2661103.2661111
Florian Loitsch
The performance of programs running in JavaScript engines is notoriously difficult to predict. Indeed, JavaScript is a complex language and, due to time-constraints and limited engineering resources, all popular virtual machines only optimize a subset of the language. Code that runs outside this (non obvious) sweet spot can pay huge performance penalties. JavaScript engines generally have at least two modes of operation: one non-optimized, and one optimized. Initially all functions are compiled to run in the non-optimized mode. Heuristics, like statistic profilers or invocation counters, then trigger the expensive recompilation of hot methods. Methods frequently see a performance improvement of an order of magnitude when they run in optimized mode. It is hence crucial that programs spend their time in optimized code. There are several ways compilers can do this: • avoid statements that cannot be optimized by the JIT. Indeed, V8 still cannot generate optimized code for all JavaScript constructs. • avoid bailouts. Optimized code is generated under the assumption that the generated code will run with similar dynamic types as seen before. If that assumption fails, the optimized code must be thrown away. • make code monomorphic. Optimized code is more efficient if it specializes for fewer dynamic types. Frequently it is possible to reduce the number of types by duplicating functions. Knowing when and where to apply these tips is almost impossible without proper tool-support. In this tutorial I will discuss the listed optimization techniques and present the tools that allow the investigation of V8 generated code. In particular, I will focus on V8s tracing flags, which report when methods are (de)optimized or inlined, Hydrogen traces, which represent V8s intermediate representation, and assembly dumps. During the talk I will concentrate on a Scheme-to-JavaScript compilation, but all talking-points will be of interest to any developer creating JavaScript code. http://floitsch.blogspot.com/2012/03/optimizing-for-v8-introduction.html
众所周知,在JavaScript引擎中运行的程序的性能很难预测。实际上,JavaScript是一种复杂的语言,由于时间限制和有限的工程资源,所有流行的虚拟机都只优化了语言的一个子集。在这个(不明显的)最佳点之外运行的代码可能会付出巨大的性能损失。JavaScript引擎通常至少有两种操作模式:一种是未优化的,另一种是优化的。最初,所有函数都被编译为在非优化模式下运行。然后,启发式方法(如统计分析器或调用计数器)会触发昂贵的热方法重新编译。方法在优化模式下运行时,通常会看到一个数量级的性能改进。因此,程序把时间花在优化代码上是至关重要的。编译器有几种方法可以做到这一点:•避免JIT无法优化的语句。事实上,V8仍然不能为所有JavaScript结构生成优化的代码。•避免救助。优化代码是在假设生成的代码将以与前面看到的类似的动态类型运行的情况下生成的。如果这个假设不成立,优化后的代码必须被丢弃。•使代码单态。优化后的代码如果专门用于更少的动态类型,则效率更高。通常可以通过复制函数来减少类型的数量。如果没有适当的工具支持,知道何时何地应用这些技巧几乎是不可能的。在本教程中,我将讨论列出的优化技术,并介绍允许研究V8生成的代码的工具。我将特别关注v8的跟踪标志(它报告方法何时被(反)优化或内联)、Hydrogen跟踪(它表示v8的中间表示)和程序集转储。在演讲中,我将集中讨论Scheme-to-JavaScript编译,但是所有的讨论点都会引起创建JavaScript代码的开发人员的兴趣。http://floitsch.blogspot.com/2012/03/optimizing-for-v8-introduction.html
{"title":"Optimizing JavaScript code for V8","authors":"Florian Loitsch","doi":"10.1145/2661103.2661111","DOIUrl":"https://doi.org/10.1145/2661103.2661111","url":null,"abstract":"The performance of programs running in JavaScript engines is notoriously difficult to predict. Indeed, JavaScript is a complex language and, due to time-constraints and limited engineering resources, all popular virtual machines only optimize a subset of the language. Code that runs outside this (non obvious) sweet spot can pay huge performance penalties.\u0000 JavaScript engines generally have at least two modes of operation: one non-optimized, and one optimized. Initially all functions are compiled to run in the non-optimized mode. Heuristics, like statistic profilers or invocation counters, then trigger the expensive recompilation of hot methods. Methods frequently see a performance improvement of an order of magnitude when they run in optimized mode. It is hence crucial that programs spend their time in optimized code.\u0000 There are several ways compilers can do this:\u0000 • avoid statements that cannot be optimized by the JIT. Indeed, V8 still cannot generate optimized code for all JavaScript constructs.\u0000 • avoid bailouts. Optimized code is generated under the assumption that the generated code will run with similar dynamic types as seen before. If that assumption fails, the optimized code must be thrown away.\u0000 • make code monomorphic. Optimized code is more efficient if it specializes for fewer dynamic types. Frequently it is possible to reduce the number of types by duplicating functions.\u0000 Knowing when and where to apply these tips is almost impossible without proper tool-support. In this tutorial I will discuss the listed optimization techniques and present the tools that allow the investigation of V8 generated code. In particular, I will focus on V8s tracing flags, which report when methods are (de)optimized or inlined, Hydrogen traces, which represent V8s intermediate representation, and assembly dumps. During the talk I will concentrate on a Scheme-to-JavaScript compilation, but all talking-points will be of interest to any developer creating JavaScript code. http://floitsch.blogspot.com/2012/03/optimizing-for-v8-introduction.html","PeriodicalId":113092,"journal":{"name":"Scheme and Functional Programming","volume":"81 1","pages":"0"},"PeriodicalIF":0.0,"publicationDate":"2012-09-09","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"117055163","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
引用次数: 0
AspectScheme: aspects in higher-order languages AspectScheme:高阶语言中的方面
Pub Date : 2012-09-09 DOI: 10.1145/2661103.2661110
Christopher Dutchyn
AspectScheme is an implementation of the Scheme programming language[5] built on MzScheme[4], providing support for pointcuts and advice aspect-oriented programming. In order to use it, place #lang racket (require (planet dutchyn/aspectscheme:1:0/aspectscheme)) in your code, before using any AspectScheme features.
AspectScheme是基于MzScheme[4]构建的Scheme编程语言[5]的实现,它提供了对切入点和建议面向方面编程的支持。为了使用它,在使用任何aspectscheme特性之前,在代码中放置#lang racket (require (planet dutchyn/aspectscheme:1:0/aspectscheme))。
{"title":"AspectScheme: aspects in higher-order languages","authors":"Christopher Dutchyn","doi":"10.1145/2661103.2661110","DOIUrl":"https://doi.org/10.1145/2661103.2661110","url":null,"abstract":"AspectScheme is an implementation of the Scheme programming language[5] built on MzScheme[4], providing support for pointcuts and advice aspect-oriented programming. In order to use it, place\u0000 #lang racket\u0000 (require (planet dutchyn/aspectscheme:1:0/aspectscheme))\u0000 in your code, before using any AspectScheme features.","PeriodicalId":113092,"journal":{"name":"Scheme and Functional Programming","volume":"292 1","pages":"0"},"PeriodicalIF":0.0,"publicationDate":"2012-09-09","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"124196374","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
引用次数: 2
期刊
Scheme and Functional Programming
全部 Acc. Chem. Res. ACS Applied Bio Materials ACS Appl. Electron. Mater. ACS Appl. Energy Mater. ACS Appl. Mater. Interfaces ACS Appl. Nano Mater. ACS Appl. Polym. Mater. ACS BIOMATER-SCI ENG ACS Catal. ACS Cent. Sci. ACS Chem. Biol. ACS Chemical Health & Safety ACS Chem. Neurosci. ACS Comb. Sci. ACS Earth Space Chem. ACS Energy Lett. ACS Infect. Dis. ACS Macro Lett. ACS Mater. Lett. ACS Med. Chem. Lett. ACS Nano ACS Omega ACS Photonics ACS Sens. ACS Sustainable Chem. Eng. ACS Synth. Biol. Anal. Chem. BIOCHEMISTRY-US Bioconjugate Chem. BIOMACROMOLECULES Chem. Res. Toxicol. Chem. Rev. Chem. Mater. CRYST GROWTH DES ENERG FUEL Environ. Sci. Technol. Environ. Sci. Technol. Lett. Eur. J. Inorg. Chem. IND ENG CHEM RES Inorg. Chem. J. Agric. Food. Chem. J. Chem. Eng. Data J. Chem. Educ. J. Chem. Inf. Model. J. Chem. Theory Comput. J. Med. Chem. J. Nat. Prod. J PROTEOME RES J. Am. Chem. Soc. LANGMUIR MACROMOLECULES Mol. Pharmaceutics Nano Lett. Org. Lett. ORG PROCESS RES DEV ORGANOMETALLICS J. Org. Chem. J. Phys. Chem. J. Phys. Chem. A J. Phys. Chem. B J. Phys. Chem. C J. Phys. Chem. Lett. Analyst Anal. Methods Biomater. Sci. Catal. Sci. Technol. Chem. Commun. Chem. Soc. Rev. CHEM EDUC RES PRACT CRYSTENGCOMM Dalton Trans. Energy Environ. Sci. ENVIRON SCI-NANO ENVIRON SCI-PROC IMP ENVIRON SCI-WAT RES Faraday Discuss. Food Funct. Green Chem. Inorg. Chem. Front. Integr. Biol. J. Anal. At. Spectrom. J. Mater. Chem. A J. Mater. Chem. B J. Mater. Chem. C Lab Chip Mater. Chem. Front. Mater. Horiz. MEDCHEMCOMM Metallomics Mol. Biosyst. Mol. Syst. Des. Eng. Nanoscale Nanoscale Horiz. Nat. Prod. Rep. New J. Chem. Org. Biomol. Chem. Org. Chem. Front. PHOTOCH PHOTOBIO SCI PCCP Polym. Chem.
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
0
微信
客服QQ
Book学术公众号 扫码关注我们
反馈
×
意见反馈
请填写您的意见或建议
请填写您的手机或邮箱
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
现在去查看 取消
×
提示
确定
Book学术官方微信
Book学术文献互助
Book学术文献互助群
群 号:481959085
Book学术
文献互助 智能选刊 最新文献 互助须知 联系我们:info@booksci.cn
Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。
Copyright © 2023 Book学术 All rights reserved.
ghs 京公网安备 11010802042870号 京ICP备2023020795号-1