Re: Writing Compilers in Functional Languages

Neelakantan Krishnaswami <neelk@cs.cmu.edu>
2 May 2005 14:29:34 -0400

          From comp.compilers

Related articles
[4 earlier articles]
Re: Writing Compilers in Functional Languages torbenm@diku.dk (2005-04-28)
Re: Writing Compilers in Functional Languages arthurvl+news@cs.uu.nl (Arthur van Leeuwen) (2005-04-28)
Re: Writing Compilers in Functional Languages tarvydas@allstream.net (Paul Tarvydas) (2005-04-28)
Re: Writing Compilers in Functional Languages neelk@cs.cmu.edu (Neelakantan Krishnaswami) (2005-04-28)
Re: Writing Compilers in Functional Languages awwaiid@thelackthereof.org (Brock) (2005-04-28)
Re: Writing Compilers in Functional Languages torbenm@diku.dk (2005-04-30)
Re: Writing Compilers in Functional Languages neelk@cs.cmu.edu (Neelakantan Krishnaswami) (2005-05-02)
Re: Writing Compilers in Functional Languages alcremi@pobox.com (Alain Cremieux) (2005-05-03)
Re: Writing Compilers in Functional Languages YRassokhin@luxoft.com (2005-05-05)
Re: Writing Compilers in Functional Languages ali@olympe.ch (Ali Al-Shabibi) (2005-05-13)
| List of all articles for this month |

From: Neelakantan Krishnaswami <neelk@cs.cmu.edu>
Newsgroups: comp.compilers
Date: 2 May 2005 14:29:34 -0400
Organization: Carnegie Mellon Univ. -- Computer Science Dept.
References: 05-04-068 05-04-084 05-04-098
Keywords: functional
Posted-Date: 02 May 2005 14:29:34 EDT

  Torben Ęgidius Mogensen wrote:
> Neelakantan Krishnaswami <neelk@cs.cmu.edu> writes:
>
>> Kkaa wrote:
>> >
>> > Are there any books or online resources that instead focus on using
>> > functional languages as implementation languages? I'm considering
>> > using Haskell or Scheme, but I'm hoping that the resources won't
>> > assume a particular functional langauge.
>>
>> Try Andrew Appel's _Modern Compiler Implementation in ML_. It uses
>> Standard ML, but translating to Haskell should be fairly straight
>> forward.
>
> I not sure about this. Appel's book uses updatable references in many
> places, such as for name generation and hash tables. These are not
> easily translated into Haskell. The same is true for exceptions.
> Additionally, though SML and Haskell are both functional languages,
> the "traditional" programming style for these is quite different - you
> would tend to use type classes, list comprehensions and monads in
> Haskell, and these are not found in SML. So translating a program
> directly from SML to Haskell will not be trivial and the result will
> be very atypical Haskell.


This is a good point, and I'm changing my mind.


When I read Appel's book, I was already decent at functional
programming, and I translated on the fly from his imperative style to
a pure style (using state passing style in ML). But if Kkaa wants to
write a compiler to learn Haskell, then this advice won't work.


--
Neel Krishnaswami
neelk@cs.cmu.edu


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.