TL;DR: This paper explores how Julia, a modern programming language for numerical computing that claims to bridge this divide by incorporating recent advances in language and compiler design, can be used for implementing software and algorithms fundamental to the field of operations research, with a focus on mathematical optimization.
Abstract: The state of numerical computing is currently characterized by a divide between highly efficient yet typically cumbersome low-level languages such as C, C++, and Fortran and highly expressive yet typically slow high-level languages such as Python and MATLAB. This paper explores how Julia, a modern programming language for numerical computing that claims to bridge this divide by incorporating recent advances in language and compiler design (such as just-in-time compilation), can be used for implementing software and algorithms fundamental to the field of operations research, with a focus on mathematical optimization. In particular, we demonstrate algebraic modeling for linear and nonlinear optimization and a partial implementation of a practical simplex code. Extensive cross-language benchmarks suggest that Julia is capable of obtaining state-of-the-art performance. Data, as supplemental material, are available at http://dx.doi.org/10.1287/ijoc.2014.0623.
TL;DR: This work analyzes forty open-source software projects written in C to answer the following questions: How does program size influence variability?
Abstract: Over 30 years ago, the preprocessor cpp was developed to extend the programming language C by lightweight metaprogramming capabilities. Despite its error-proneness and low abstraction level, the preprocessor is still widely used in present-day software projects to implement variable software. However, not much is known about how cpp is employed to implement variability. To address this issue, we have analyzed forty open-source software projects written in C. Specifically, we answer the following questions: How does program size influence variability? How complex are extensions made via cpp's variability mechanisms? At which level of granularity are extensions applied? Which types of extension occur? These questions revive earlier discussions on program comprehension and refactoring in the context of the preprocessor. To provide answers, we introduce several metrics measuring the variability, complexity, granularity, and types of extension applied by preprocessor directives. Based on the collected data, we suggest alternative implementation techniques. Our data set is a rich source for rethinking language design and tool support.
TL;DR: In this paper, the Boost Type Traits Library is described as a collection of properties and properties of C++ programs, and the Boost Spirit library is used for preprocessor metaprogramming.
Abstract: Preface. Acknowledgments. Making the Most of This Book. 1. Introduction. Getting Started. So What's a Metaprogram? Metaprogramming in the Host Language. Metaprogramming in C++. Why Metaprogramming? When Metaprogramming? Why a Metaprogramming Library? 2. Traits and Type Manipulation. Type Associations. Metafunctions. Numerical Metafunctions. Making Choices at Compile Time. A Brief Tour of the Boost Type Traits Library. Nullary Metafunctions. Metafunction Definition. History. Details. Exercises. 3. A Deeper Look at Metafunctions. Dimensional Analysis. Higher-Order Metafunctions. Handling Placeholders. More Lambda Capabilities. Lambda Details. Details. Exercises. 4. Integral Type Wrappers and Operations. Boolean Wrappers and Operations. Integer Wrappers and Operations. Exercises. 5. Sequences and Iterators. Concepts. Sequences and Algorithms. Iterators. Iterator Concepts. Sequence Concepts. Sequence Equality. Intrinsic Sequence Operations. Sequence Classes. Integral Sequence Wrappers. Sequence Derivation. Writing Your Own Sequence. Details. Exercises. 6. Algorithms. Algorithms, Idioms, Reuse, and Abstraction. Algorithms in the MPL. Inserters. Fundamental Sequence Algorithms. Querying Algorithms. Sequence Building Algorithms. Writing Your Own Algorithms. Details. Exercises. 7. Views and Iterator Adaptors. A Few Examples. View Concept. Iterator Adaptors. Writing Your Own View. History. Exercises. 8. Diagnostics. Debugging the Error Novel. Using Tools for Diagnostic Analysis. Intentional Diagnostic Generation. History. Details. Exercises. 9. Crossing the Compile-Time/Runtime Boundary. for each. Implementation Selection. Object Generators. Structure Selection. Class Composition. (Member) Function Pointers as Template Arguments. Type Erasure. The Curiously Recurring Template Pattern. Explicitly Managing the Overload Set. The "sizeof Trick". Summary. Exercises. 10. Domain-Specific Embedded Languages. A Little Language. Goes a Long Way. DSLs, Inside Out. C++ as the Host Language. Blitz++ and Expression Templates. General-Purpose DSELs. The Boost Spirit Library. Summary. Exercises. 11. A DSEL DesignWalkthrough. Finite State Machines. Framework Design Goals. Framework Interface Basics. Choosing a DSL. Implementation. Analysis. Language Directions. Exercises. Appendix A. An Introduction to Preprocessor Metaprogramming. Motivation. Fundamental Abstractions of the Preprocessor. Preprocessor Library Structure. Preprocessor Library Abstractions. Exercise. Appendix B. The typename and template Keywords. The Issue. The Rules. Appendix C. Compile-Time Performance. The Computational Model. Managing Compilation Time. The Tests. Appendix D. MPL Portability Summary. Bibliography. Index.
TL;DR: Partial evaluation provides a unifying paradigm for a broad spectrum of work in program optimization compiling interpretation and the generation of automatic program generators and has important applications to scientific computing, logic programming, metaprogramming, and expert systems.
Abstract: Partial evaluation provides a unifying paradigm for a broad spectrum of work in program optimization compiling interpretation and the generation of automatic program generators [Bjorner et al. 1987; Ershov 1992; and Jones et al. 1993]. It is a program optimization technique, perhaps better called program specialization, closely related to but different from Jorring and Scherlis' staging transformations [1986]. It emphasizes, in comparison with Burstall and Darlington [1977] and Jorring and Scherlis [1986] and other program transformation work, full automation and the generation of program generators as well as transforming single programs. Much partial evaluation work to date has concerned automatic compiler generation from an interpretive definition of programming language, but it also has important applications to scientific computing, logic programming, metaprogramming, and expert systems; some pointers are given later.
TL;DR: MetaBorg is described, a method for providing concrete syntax for domain abstractions to application programmers by embedding domain-specific languages in a general purpose host language and assimilating the embedded domain code into the surrounding host code.
Abstract: Application programmer's interfaces give access to domain knowledge encapsulated in class libraries without providing the appropriate notation for expressing domain composition. Since object-oriented languages are designed for extensibility and reuse, the language constructs are often sufficient for expressing domain abstractions at the semantic level. However, they do not provide the right abstractions at the syntactic level. In this paper we describe MetaBorg, a method for providing concrete syntax for domain abstractions to application programmers. The method consists of embedding domain-specific languages in a general purpose host language and assimilating the embedded domain code into the surrounding host code. Instead of extending the implementation of the host language, the assimilation phase implements domain abstractions in terms of existing APIs leaving the host language undisturbed. Indeed, MetaBorg can be considered a method for promoting APIs to the language level. The method is supported by proven and available technology, i.e. the syntax definition formalism SDF and the program transformation language and toolset Stratego/XT. We illustrate the method with applications in three domains: code generation, XML generation, and user-interface construction.