7

在功能范式中,功能是主要的“控制结构”。例如,+运算符也被视为一个函数,您可以像传递任何其他“对象”一样传递它们。我想知道,如果我必须实现一种玩具函数式语言,我是将简单的函数实现为真正的函数(即翻译+成可调用的例程)还是将它们翻译成普通指令,然后将它们“内联”到翻译的代码中。但是,使用第二种策略,我是否能够像在 haskell 中那样传递它们并部分应用它们?您对实现/翻译函数作为函数式语言的中心思想有何看法?

4

1 回答 1

0

I can recommend the PJL book. I wrote a compiler with help from it (in 1989-90, in Prolog) and the book is a very good introduction to the subject.

It might be dated (written in 1987, 30 years ago) but it still covers the basics very well. It is, however, completely focused on lazy languages like Haskell. At the time Haskell did not exist and the book uses LML or Miranda, a predecessor language but the languages are very close.

于 2016-03-21T11:42:31.400 回答