caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Good book about ML compilation ?
@ 2009-08-20 18:40 rixed
  2009-08-20 21:47 ` [Caml-list] " Richard Jones
  2009-08-20 22:02 ` Jon Harrop
  0 siblings, 2 replies; 5+ messages in thread
From: rixed @ 2009-08-20 18:40 UTC (permalink / raw)
  To: caml-list

Hello !

Suppose I want to learn how ML is compiled, and especialy how OCaml is
compiled, it's various internal lambda representations and the like.
Would this book :

http://www.amazon.com/Modern-Compiler-Implementation-Andrew-Appel/dp/0521607647/

be a good one ?

It's hard to tell what this book's worth from the customer advices ; it's
especialy hard to tell if it fits well to OCaml or not.



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Caml-list] Good book about ML compilation ?
  2009-08-20 18:40 Good book about ML compilation ? rixed
@ 2009-08-20 21:47 ` Richard Jones
  2009-08-21 15:00   ` rixed
  2009-08-20 22:02 ` Jon Harrop
  1 sibling, 1 reply; 5+ messages in thread
From: Richard Jones @ 2009-08-20 21:47 UTC (permalink / raw)
  To: rixed; +Cc: caml-list

On Thu, Aug 20, 2009 at 08:40:52PM +0200, rixed@happyleptic.org wrote:
> Hello !
> 
> Suppose I want to learn how ML is compiled, and especialy how OCaml is
> compiled, it's various internal lambda representations and the like.
> Would this book :
> 
> http://www.amazon.com/Modern-Compiler-Implementation-Andrew-Appel/dp/0521607647/
> 
> be a good one ?

I read this book last year.  It's mainly directed towards writing a
compiler for imperative languages.  I didn't find it to be anything
particularly special, but I guess it's OK if you want to know the
basics of writing things like garbage collectors.

For functional programming specifically, you might try Simon
Peyton-Jones's book "The Implementation of Functional Programming
Languages".  This used to be available free here, but as I write the
website is down:

http://research.microsoft.com/en-us/um/people/simonpj/papers/slpj-book-1987/

I have a local copy of it if you don't locate one.

> It's hard to tell what this book's worth from the customer advices ; it's
> especialy hard to tell if it fits well to OCaml or not.

Best way to find out how OCaml is implemented is to read
the source.

Rich.

-- 
Richard Jones
Red Hat


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Caml-list] Good book about ML compilation ?
  2009-08-20 18:40 Good book about ML compilation ? rixed
  2009-08-20 21:47 ` [Caml-list] " Richard Jones
@ 2009-08-20 22:02 ` Jon Harrop
  2009-08-21 15:09   ` rixed
  1 sibling, 1 reply; 5+ messages in thread
From: Jon Harrop @ 2009-08-20 22:02 UTC (permalink / raw)
  To: caml-list

On Thursday 20 August 2009 19:40:52 rixed@happyleptic.org wrote:
> Hello !
>
> Suppose I want to learn how ML is compiled, and especialy how OCaml is
> compiled, it's various internal lambda representations and the like.
> Would this book :
>
> http://www.amazon.com/Modern-Compiler-Implementation-Andrew-Appel/dp/052160
>7647/
>
> be a good one ?
>
> It's hard to tell what this book's worth from the customer advices ; it's
> especialy hard to tell if it fits well to OCaml or not.

I found that book often glossed over aspects of the compiler that I was unable 
to implement myself at the time. That was frustrating. I also found SML 
cumbersome compared to OCaml.

I much preferred another of Appel's books as an introduction to writing a 
compiler:

http://www.amazon.com/Compiling-Continuations-Andrew-W-Appel/dp/052103311X/ref=pd_sim_b_3_img

However, you could probably learn far more efficiently from another resource. 
In particular, you can easily thrash today's ML compilers by using some of 
the excellent tools and libraries like LLVM and more modern techniques like 
monomorphization during JIT compilation. You might also want tuples as 
structs to relieve the stress on the GC. These are some of the techniques I 
am using for HLVM and the results speak for themselves (and I am describing 
them in detail in OCaml Journal articles).

If you want to learn how ML is (or should be) compiled then I think your best 
bet is probably to ask here. I also recommend reading the source code to the 
OCaml and F# compilers. Are you also interested in GCs?

-- 
Dr Jon Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/?e


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Caml-list] Good book about ML compilation ?
  2009-08-20 21:47 ` [Caml-list] " Richard Jones
@ 2009-08-21 15:00   ` rixed
  0 siblings, 0 replies; 5+ messages in thread
From: rixed @ 2009-08-21 15:00 UTC (permalink / raw)
  To: caml-list

> For functional programming specifically, you might try Simon
> Peyton-Jones's book "The Implementation of Functional Programming
> Languages".  This used to be available free here, but as I write the
> website is down:
> 
> http://research.microsoft.com/en-us/um/people/simonpj/papers/slpj-book-1987/

It works right now, and seams interresting indeed.
Thank you for this valuable bookmark.
I hope they use the same designations as in OCaml source for the more
abstract concept :)

> Best way to find out how OCaml is implemented is to read
> the source.

Yes, I'm doing plenty of that now.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Caml-list] Good book about ML compilation ?
  2009-08-20 22:02 ` Jon Harrop
@ 2009-08-21 15:09   ` rixed
  0 siblings, 0 replies; 5+ messages in thread
From: rixed @ 2009-08-21 15:09 UTC (permalink / raw)
  To: caml-list

> I much preferred another of Appel's books as an introduction to writing a 
> compiler:
> 
> http://www.amazon.com/Compiling-Continuations-Andrew-W-Appel/dp/052103311X/ref=pd_sim_b_3_img

Looks interresting also.

Thank you both for your advices.

> However, you could probably learn far more efficiently from another resource. 
> In particular, you can easily thrash today's ML compilers by using some of 
> the excellent tools and libraries like LLVM and more modern techniques like 
> monomorphization during JIT compilation. You might also want tuples as 
> structs to relieve the stress on the GC. These are some of the techniques I 
> am using for HLVM and the results speak for themselves (and I am describing 
> them in detail in OCaml Journal articles).

This is also very interresting, and I already tried to install HLVM
once. But my free time, as well as the lack of freely available documentation
on this interresting project, force me to wait longer before jumping in.

> If you want to learn how ML is (or should be) compiled then I think your best 
> bet is probably to ask here. I also recommend reading the source code to the 
> OCaml and F# compilers. Are you also interested in GCs?

I think OCaml's GC is well documented compared to the other parts of the system
(but probably this is because I ignore what everyone involved in writing a
compiler already know).


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-08-21 15:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-08-20 18:40 Good book about ML compilation ? rixed
2009-08-20 21:47 ` [Caml-list] " Richard Jones
2009-08-21 15:00   ` rixed
2009-08-20 22:02 ` Jon Harrop
2009-08-21 15:09   ` rixed

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).