Using attribute grammars to derive efficient functional programs

M.F. Kuiper, S. Doaitse Swierstra · Utrecht University Repository (Utrecht University) · 1986

Two mappings from attribute grammars to lazy functional programs are defined. One of these mappings is an efficient implementation of attribute grammars. The other mapping yields inefficient programs. It is shown how some transformations of functional programs may be better understood by viewing the programs as inefficient implementations of attribute grammars. 1 Introduction The transformational approach to programming starts with writing very clear and obviously correct programs. These programs are usually not very efficient. The efficiency of the programs is improved by applying successive transformations. In this article we show that rewrite rules employing tupling[11] and deriving circular programs can be more easily expressed using attribute grammars[9, 10]. The method we decsribe also results in a form of common subexpression elimination. We define two mappings from attribute grammars to functional programs. One of these mappings, SIM, yields programs that visit the node...

Cited by 37 works. Open-access PDF

Authors