« Return to Thread: [scala-tools] Compiler books

Re: [scala-tools] Compiler books

by Daniel Spiewak :: Rate this Message:

Reply to Author | View in Thread

I can give you some general compiler book suggestions.  None of these will specifically help you with Scala, but they should give you a decent idea of what needs to happen in any good compiler:
You might also look around for papers on parsing techniques, just because they're that cool.  :-)  Scala has a hand-written parser which I believe uses recursive-descent, but I haven't looked closely enough to be sure.  For what you're doing, you shouldn't have to change anything in the syntactic analysis, but it's still worth knowing at least generally what's going on in that arena.

Daniel

On Sun, Jun 28, 2009 at 5:26 PM, Erkki Lindpere <erkki@...> wrote:
Can anyone recommend a good book or online resource on compilers that would help understand the Scala compiler?

I want to create a plug-in that does vector math optimizations*, but I've never studied compilers and many things in the compiler seem really foreign to me.

* I think scalar replacement is what it's called -- given the type Vector2(x: Float, y: Float) { /* operations */ }, I want to replace
1) local variables:
 val v = new Vector2(1f, 2f)  -->  val v$x = 1f; val v$y = 2f
2) any operations on Vectors with operations on Floats
3) any escaping vectors with new Vector2(v$x, v$y) -- most of the time they will not escape

Or should I just wait until JIT can do this better? :)

Erkki

 « Return to Thread: [scala-tools] Compiler books