views:

142

answers:

1

In my graduate class on compiler construction we've been introduced to the concept of a lattice. Three lectures have been devoted to lattices and so far it seems like an interesting tangent, but the dilemma is that it doesn't really help explain how a compiler uses a lattice to solve a concrete problem.

We have already covered parsing and typechecking. We're about to start liveness analysis and register allocation.

Note, I'm not looking for resources on building compilers. The following list of links have that covered pretty well. What I'm looking for is an explanation on the relationship between compilers and lattices, bonus points for the most examples.

http://stackoverflow.com/questions/41785/learning-resources-on-parsers-interpreters-and-compilers
http://stackoverflow.com/questions/351690/how-much-of-the-compiler-should-we-know
http://stackoverflow.com/questions/1669/learning-to-write-a-compiler

+1  A: 

Lattices are a very useful structure to represent state while doing static analysis on the program being compiled - eg. for removing dead code detected by liveness analysis, available/very busy expressions, reaching definitions, sign analysis and constant propagation.

Here is a very good read if you want the details: Lecture Notes on Static Analysis

Jørn Schou-Rode