没有合适的资源?快使用搜索试试~ 我知道了~
implementing functional languages
需积分: 10 13 下载量 13 浏览量
2018-10-29
10:48:51
上传
评论
收藏 1.24MB PDF 举报
温馨提示
试读
296页
实现函数式编程语言,可以帮助你写一个语法分析器,书中主要使用haskell
资源推荐
资源详情
资源评论
Implementing Funtional Languages:
a tutorial
Simon L Peyton Jones
Department of Computing Siene, University of Glasgow
and David R Lester
Department of Computer Siene, University of Manhester
1991
Marh 23, 2000
This b o ok is dediated to the memory of our friend and olleague Jon Salkild
(1963-1991).
1
Contents
Prefae 5
1 The Core language 10
1.1 An overview of the Core language . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
1.2 Syntax of the Core language . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
1.3 Data types for the Core language . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
1.4 A small standard prelude . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
1.5 A pretty-printer for the Core language . . . . . . . . . . . . . . . . . . . . . . . . 20
1.6 A parser for the Core language . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
2 Template instantiation 42
2.1 A review of template instantiation . . . . . . . . . . . . . . . . . . . . . . . . . . 42
2.2 State transition systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
2.3 Mark 1: A minimal template instantiation graph reduer . . . . . . . . . . . . . . 50
2.4 Mark 2:
let(re)
expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
2.5 Mark 3: Adding up dating . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
2.6 Mark 4: Adding arithmeti . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
2.7 Mark 5: Strutured data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
2.8 Alternative implementations
y
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
2.9 Garbage olletion
y
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
3 The G-mahine 83
3.1 Intro dution to the G-mahine . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
3.2 Co de sequenes for building templates . . . . . . . . . . . . . . . . . . . . . . . . 85
3.3 Mark 1: A minimal G-mahine . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
2
3.4 Mark 2: Making it lazy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
3.5 Mark 3:
let(re)
expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
3.6 Mark 4: Adding primitives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
3.7 Mark 5: Towards b etter handling of arithmeti . . . . . . . . . . . . . . . . . . . 119
3.8 Mark 6: Adding data strutures . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
3.9 Mark 7: Further improvements . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
3.10 Conlusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
4 TIM: the three instrution mahine 143
4.1 Bakground: How TIM works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
4.2 Mark 1: A minimal TIM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
4.3 Mark 2: Adding arithmeti . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
4.4 Mark 3:
let(re)
expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
4.5 Mark 4: Updating . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172
4.6 Mark 5: Strutured data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183
4.7 Mark 6: Constant appliative forms and the o de store
y
. . . . . . . . . . . . . . 189
4.8 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192
5 A Parallel G-mahine 196
5.1 Intro dution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196
5.2 Mark 1: A minimal parallel G-mahine . . . . . . . . . . . . . . . . . . . . . . . . 200
5.3 Mark 2: The evaluate-and-die mo del . . . . . . . . . . . . . . . . . . . . . . . . . 209
5.4 Mark 3: A realisti parallel G-mahine . . . . . . . . . . . . . . . . . . . . . . . . 212
5.5 Mark 4: A b etter way to handle blo king . . . . . . . . . . . . . . . . . . . . . . 214
5.6 Conlusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216
6 Lamb da Lifting 217
6.1 Intro dution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217
6.2 Improving the
expr
data typ e . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217
6.3 Mark 1: A simple lambda lifter . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221
6.4 Mark 2: Improving the simple lamb da lifter . . . . . . . . . . . . . . . . . . . . . 230
6.5 Mark 3: Johnsson-style lambda lifting . . . . . . . . . . . . . . . . . . . . . . . . 231
6.6 Mark 4: A separate full laziness pass . . . . . . . . . . . . . . . . . . . . . . . . . 236
3
6.7 Mark 5: Improvements to full laziness . . . . . . . . . . . . . . . . . . . . . . . . 250
6.8 Mark 6: Dependeny analysis
y
. . . . . . . . . . . . . . . . . . . . . . . . . . . . 252
6.9 Conlusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260
A Utilities mo dule 262
A.1 The heap type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262
A.2 The asso iation list typ e . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264
A.3 Generating unique names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265
A.4 Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265
A.5 Other useful funtion denitions . . . . . . . . . . . . . . . . . . . . . . . . . . . 267
B Example Core-language programs 268
B.1 Basi programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268
B.2
let
and
letre
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269
B.3 Arithmeti . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269
B.4 Data strutures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270
4
剩余295页未读,继续阅读
资源评论
chaihahaha
- 粉丝: 0
- 资源: 25
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 三次样条插值的介绍-什么是三次样条插值原理
- http的一些相关介绍-对于我们来说什么是http
- 全卷积网络基于voc2012数据集简单pytorch实现
- pycharm的一些介绍-用于更好的学习python
- 基于C++的程序设计大赛天梯赛L2答案(天梯赛)
- 基于python实现的三次样条插值和均值插值法实现
- Python语言教程2-python批量图片大小处理-多文件夹
- Python语言教程1-python批量图片重命名,将后缀某几个不想要的字去除
- Space Combat Kit 太空战斗套件Unity游戏开发插件资源unitypackage C#
- Universal Device Preview 通用设备预览Unity游戏开发插件资源unitypackage
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功