In CPS we don’t have nested expressions anymore. What is CPSĬPS is a restriction of how a functional language works. In this post, we’re going to walk through a different intermediate representation: CPS. In my second to last post we transformed a functional language into something like SSA. We want to get rid of complicated nested expressions because chances are our compilation target doesn’t support them. Now one of the biggest decisions in any compiler is what to do with expressions. The benefit here is that this maps more straight to a series of conditionals (or jumps). We’ve transformed our large nested pattern into a series of simpler, unnested patterns. Note to future me, write a pattern matching compiler Case x of (a, b) -> case a of 1 -> case b of 2 -> True _ -> False _ -> False
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |