Engineering a simple, efficient code-generator generator

Many code-generator generators use tree pattern matching and dynamic programming. This paper describes a simple program that generates matchers that are fast, compact, and easy to understand. It is simpler than common alternatives: 200–700 lines of Icon or 950 lines of C versus 3000 lines of C for Twig and 5000 for burg. Its matchers run up to 25 times faster than Twig's. They are necessarily slower than burg's BURS (bottom-up rewrite system) matchers, but they are more flexible and still practical.

[1]  Susan L. Graham,et al.  Optimal Code Generation for Expression Trees: An Application of BURS (bottom-Up Rewrite Systems) Theory , 1988 .

[2]  Helmut Emmelmann,et al.  BEG: a generator for efficient back ends , 1989, PLDI '89.

[3]  Christopher W. Fraser,et al.  Hard‐coding bottom‐up code generation tables to save time and space , 1990, Softw. Pract. Exp..

[4]  Christopher W. Fraser,et al.  A code generation interface for ANSI C , 1991, Softw. Pract. Exp..

[5]  Christopher W. Fraser,et al.  BURG: fast optimal instruction selection and tree parsing , 1992, SIGP.

[6]  Alfred V. Aho,et al.  Optimal Code Generation for Expression Trees , 1976, J. ACM.

[7]  Alfred V. Aho,et al.  Code generation using tree matching and dynamic programming , 1989, ACM Trans. Program. Lang. Syst..

[8]  Christoph M. Hoffmann,et al.  Pattern Matching in Trees , 1982, JACM.

[9]  Ralph E. Griswold,et al.  The ICON Programming Language, 2nd Ed. , 1990 .

[10]  David R. Chase,et al.  An improvement to bottom-up tree pattern matching , 1987, POPL '87.

[11]  Ralph E. Griswold String Scanning in the Icon Programming Language , 1990, Comput. J..

[12]  Reinhard Wilhelm,et al.  Tree automata for code selection , 1994, Acta Informatica.

[13]  Alfred V. Aho,et al.  Efficient string matching , 1975, Commun. ACM.

[14]  Alfred V. Aho,et al.  Compilers: Principles, Techniques, and Tools , 1986, Addison-Wesley series in computer science / World student series edition.

[15]  Christopher W. Fraser,et al.  A retargetable compiler for ANSI C , 1991, SIGP.

[16]  Dhananjay M. Dhamdhere,et al.  Efficient Retargetable Code Generation Using Bottom-up Tree Pattern Matching , 1990, Comput. Lang..

[17]  Ralph E. Griswold,et al.  The Icon programming language , 1983 .

[18]  Christopher W. Fraser A language for writing code generators , 1989, PLDI '89.

[19]  Todd A. Proebsting Simple and efficient BURS table generation , 1992, PLDI '92.