Yield grammar analysis and product optimization in a domain-specific language for dynamic programming
Dynamic programming algorithms are traditionally expressed by a set of matrix recurrencesa low level of abstraction, which renders the design of novel dynamic programming algorithms difficult and makes debugging cumbersome. Bellman's GAP is a declarative, domain-specific language, which supports dynamic programming over sequence data. It implements the algebraic style of dynamic programming and allows one to specify algorithms by combining so-called yield grammars with evaluation algebras. Products on algebras allow to create novel types of analyses from already given ones, without modifying tested components. Bellman's GAP extends the previous concepts of algebraic dynamic programming in several respects, such as an interleaved product operation and the analysis of multi-track input. Extensive analysis of the yield grammar and the evaluation algebras is required for generating efficient imperative code from the algebraic specification. This article gives an overview of the analyses required and presents several of them in detail. Measurements with real-world applications demonstrate the quality of the code produced.
domain-specific language algebraic dynamic programming regular tree grammar compiler optimization rna structure prediction