We exhibit an aggressive optimizing compiler for a functionalprogramming language which includes a first-class forward automatic differentiation (AD) operator. The compiler’s performance is competitive with FORTRAN-based systems on our numerical examples, despite the potential inefficiencies entailed by support of a functional-programming language and a first-class AD operator. These results are achieved by combining (1) a novel formulation of forward AD in terms of a reflexive mechanism that supports firstclass nestable nonstandard interpretation with (2) the migration to compile-time of the conceptually run-time nonstandard interpretation by whole-program inter-procedural flow analysis. Categories and Subject Descriptors G.1.4 [Quadrature and Numerical Differentiation]: Automatic differentiation; D.3.2 [Language Classifications]: Applicative (functional) languages; D.3.4 [Processors]: Code generation, Compilers, Optimization; F.3.2 [Semantics of Programming Languages]: Partial evaluation, Program analysis


Forward AD, Source-to-source transformation, Reflection, Higher-order functions, Nonstandard interpretation

Date of this Version

January 2008