第十五章 定义语法.pdfVIP

  • 5
  • 0
  • 约2.27千字
  • 约 3页
  • 2017-05-29 发布于浙江
  • 举报
第十五章 定义语法

第⼗五章 定义语法 15.1 简介 15.2 实例:简单宏 15.3 syntax-rule的更多细节 15.1 简介 本章中,我会讲解如何⾃定义语法。⽤户定义语法称 宏 (Macro )。Lisp/Scheme 中 的宏⽐C语⾔中的宏更加强⼤。宏可以使你的程序优美⽽紧凑。 宏是代码的变换。代码在被求值或编译前进⾏变换,and the procedure continues as if the transformed codes are written from the be innin . 你可以在Scheme 中通过⽤符合R5RS规范的syntax-rules轻易地定义简单宏,相⽐ 之下,在Common Lisp 中⾃定义语法就复杂多了。使⽤syntax-rules可以直接定义 宏⽽不⽤担⼼变量的捕获 (Variable Capture )。On the other hand , definin complicated macros that cannot be defined usin the syntax-rules is more difficult than that of the Common Lisp . 15.2 实例:简单宏 我将以⼀个

文档评论(0)

1亿VIP精品文档

相关文档