TY - GEN
T1 - Multi-stage programming with functors and monads
T2 - 4th International Conference on Generative Programming and Component Engineering, GPCE 2005
AU - Carette, Jacques
AU - Kiselyov, Oleg
N1 - Funding Information:
We wish to thank Cristiano Calgano for his help in adapting camlp4 for use with MetaOCaml. Many helpful discussions with Walid Taha are very appreciated. The implementation of the monadic notation, perform, was joint work with Lydia van Dijk. We gratefully acknowledge numerous, helpful suggestions by the anonymous reviewers. The first author was supported in part by NSERC Discovery Grant RPG262084-03.
PY - 2005
Y1 - 2005
N2 - With Gaussian Elimination as a representative family of numerical and symbolic algorithms, we use multi-stage programming, monads and Ocaml's advanced module system to demonstrate the complete elimination of the abstraction overhead while avoiding any inspection of the generated code. We parameterize our Gaussian Elimination code to a great extent (over domain, matrix representations, determinant tracking, pivoting policies, result types, etc) at no run-time cost. Because the resulting code is generated just right and not changed afterwards, we enjoy MetaOCaml's guaranty that the generated code is well-typed. We further demonstrate that various abstraction parameters (aspects) can be made orthogonal and compositional, even in the presence of name-generation for temporaries and other bindings and "interleaving" of aspects. We also show how to encode some domain-specific knowledge so that "clearly wrong" compositions can be statically rejected by the compiler when processing the generator rather than the generated code.
AB - With Gaussian Elimination as a representative family of numerical and symbolic algorithms, we use multi-stage programming, monads and Ocaml's advanced module system to demonstrate the complete elimination of the abstraction overhead while avoiding any inspection of the generated code. We parameterize our Gaussian Elimination code to a great extent (over domain, matrix representations, determinant tracking, pivoting policies, result types, etc) at no run-time cost. Because the resulting code is generated just right and not changed afterwards, we enjoy MetaOCaml's guaranty that the generated code is well-typed. We further demonstrate that various abstraction parameters (aspects) can be made orthogonal and compositional, even in the presence of name-generation for temporaries and other bindings and "interleaving" of aspects. We also show how to encode some domain-specific knowledge so that "clearly wrong" compositions can be statically rejected by the compiler when processing the generator rather than the generated code.
UR - http://www.scopus.com/inward/record.url?scp=33646133205&partnerID=8YFLogxK
UR - http://www.scopus.com/inward/citedby.url?scp=33646133205&partnerID=8YFLogxK
U2 - 10.1007/11561347_18
DO - 10.1007/11561347_18
M3 - Conference contribution
AN - SCOPUS:33646133205
SN - 3540291385
SN - 9783540291381
T3 - Lecture Notes in Computer Science (including subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics)
SP - 256
EP - 274
BT - Lecture Notes in Computer Science (including subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics)
Y2 - 29 September 2005 through 1 October 2005
ER -