title: Generating Efficient Code for Lazy Functional Languages authors: Sjaak Smetsers, Eric Nocker, John van Groningen, Rinus Plasmeijer In this paper we will discuss how a good code generator can be built for (lazy) functional languages. Starting from Concurrent Clean, an experimental lazy functional programming language, code is generated for an intermediate abstract machine: the ABC machine. In this first pass many well-known optimisation techniques are included. However, we will also present some new ideas in this area, like the way in which strictness can be incorporated, and the implementation of higher order functions. In a second pass, the ABC code is translated to concrete target code for the Motorola MC680x0 processor. Again many optimisation methods appear to be applicable. Some of them (for example register allocation algorithms) are common for the implementation of other types of languages, but have to be adapted because of the specific properties of both source language and target machine. Other optimisations are specific for lazy functional languages, e.g. the implementation of higher order functions, efficient memory management and the optimised graph reduction. Measurements demonstrate that due to the optimisations of both passes very fast code can be generated. We have compared Concurrent Clean with two other functional languages, namely Lml and Hope, and also with the imperative language C. With respect to both functional languages this comparison clearly goes in favour of Concurrent Clean. Furthermore, we can conclude that, when using the presented compilation techniques, a lazy functional language is able to compete even with an imperative language such as C.