1,968 research outputs found
Recommended from our members
Collapsing towers of interpreters
Given a tower of interpreters, i.e., a sequence of multiple interpreters interpreting one another as input programs, we aim to collapse this tower into a compiler that removes all interpretive overhead and runs in a single pass. In the real world, a use case might be Python code executed by an x86 runtime, on a CPU emulated in a JavaScript VM, running on an ARM CPU. Collapsing such a tower can not only exponentially improve runtime performance, but also enable the use of base-language tools for interpreted programs, e.g., for analysis and verification. In this paper, we lay the foundations in an idealized but realistic setting.
We present a multi-level lambda calculus that features staging constructs and stage polymorphism: based on runtime parameters, an evaluator either executes source code (thereby acting as an interpreter) or generates code (thereby acting as a compiler). We identify stage polymorphism, a programming model from the domain of high-performance program generators, as the key mechanism to make such interpreters compose in a collapsible way.
We present Pink, a meta-circular Lisp-like evaluator on top of this calculus, and demonstrate that we can collapse arbitrarily many levels of self-interpretation, including levels with semantic modifications. We discuss several examples: compiling regular expressions through an interpreter to base code, building program transformers from modi ed interpreters, and others. We develop these ideas further to include reflection and reification, culminating in Purple, a reflective language inspired by Brown, Blond, and Black, which realizes a conceptually infinite tower, where every aspect of the semantics can change dynamically. Addressing an open challenge, we show how user programs can be compiled and recompiled under user-modified semantics.Parts of this research were supported by ERC grant 321217, NSF awards 1553471 and 1564207, and DOE award DE-SC0018050
MELT - a Translated Domain Specific Language Embedded in the GCC Compiler
The GCC free compiler is a very large software, compiling source in several
languages for many targets on various systems. It can be extended by plugins,
which may take advantage of its power to provide extra specific functionality
(warnings, optimizations, source refactoring or navigation) by processing
various GCC internal representations (Gimple, Tree, ...). Writing plugins in C
is a complex and time-consuming task, but customizing GCC by using an existing
scripting language inside is impractical. We describe MELT, a specific
Lisp-like DSL which fits well into existing GCC technology and offers
high-level features (functional, object or reflexive programming, pattern
matching). MELT is translated to C fitted for GCC internals and provides
various features to facilitate this. This work shows that even huge, legacy,
software can be a posteriori extended by specifically tailored and translated
high-level DSLs.Comment: In Proceedings DSL 2011, arXiv:1109.032
Mathemagix User Guide
101 pagesThis manual describes the Mathemagix programming language (http://www.mathemagix.org)
Pure subtype systems: a type theory for extensible software
This thesis presents a novel approach to type theory called âpure subtype systemsâ,
and a core calculus called DEEP which is based on that approach. DEEP is capable
of modeling a number of interesting language techniques that have been proposed in
the literature, including mixin modules, virtual classes, feature-oriented programming,
and partial evaluation.
The design of DEEP was motivated by two well-known problems: âthe expression
problemâ, and âthe tag elimination problem.â The expression problem is concerned
with the design of an interpreter that is extensible, and requires an advanced module
system. The tag elimination problem is concerned with the design of an interpreter that
is efficient, and requires an advanced partial evaluator. We present a solution in DEEP
that solves both problems simultaneously, which has never been done before.
These two problems serve as an âacid testâ for advanced type theories, because they
make heavy demands on the static type system. Our solution in DEEP makes use of the
following capabilities. (1) Virtual types are type definitions within a module that can
be extended by clients of the module. (2) Type definitions may be mutually recursive.
(3) Higher-order subtyping and bounded quantification are used to represent partial
information about types. (4) Dependent types and singleton types provide increased
type precision.
The combination of recursive types, virtual types, dependent types, higher-order
subtyping, and bounded quantification is highly non-trivial. We introduce âpure subtype
systemsâ as a way of managing this complexity. Pure subtype systems eliminate
the distinction between types and objects; every term can behave as either a type or
an object depending on context. A subtype relation is defined over all terms, and subtyping,
rather than typing, forms the basis of the theory. We show that higher-order
subtyping is strong enough to completely subsume the traditional type relation, and
we provide practical algorithms for type checking and for finding minimal types.
The cost of using pure subtype systems lies in the complexity of the meta-theory.
Unfortunately, we are unable to establish some basic meta-theoretic properties, such as
type safety and transitivity elimination, although we have made some progress towards
these goals. We formulate the subtype relation as an abstract reduction system, and we
show that the type theory is sound if the reduction system is confluent. We can prove
that reductions are locally confluent, but a proof of global confluence remains elusive.
In summary, pure subtype systems represent a new and interesting approach to
type theory. This thesis describes the basic properties of pure subtype systems, and
provides concrete examples of how they can be applied. The Deep calculus demonstrates
that our approach has a number of real-world practical applications in areas that
have proved to be quite difficult for traditional type theories to handle. However, the
ultimate soundness of the technique remains an open question
Kolmogorov Complexity in perspective. Part II: Classification, Information Processing and Duality
We survey diverse approaches to the notion of information: from Shannon
entropy to Kolmogorov complexity. Two of the main applications of Kolmogorov
complexity are presented: randomness and classification. The survey is divided
in two parts published in a same volume. Part II is dedicated to the relation
between logic and information system, within the scope of Kolmogorov
algorithmic information theory. We present a recent application of Kolmogorov
complexity: classification using compression, an idea with provocative
implementation by authors such as Bennett, Vitanyi and Cilibrasi. This stresses
how Kolmogorov complexity, besides being a foundation to randomness, is also
related to classification. Another approach to classification is also
considered: the so-called "Google classification". It uses another original and
attractive idea which is connected to the classification using compression and
to Kolmogorov complexity from a conceptual point of view. We present and unify
these different approaches to classification in terms of Bottom-Up versus
Top-Down operational modes, of which we point the fundamental principles and
the underlying duality. We look at the way these two dual modes are used in
different approaches to information system, particularly the relational model
for database introduced by Codd in the 70's. This allows to point out diverse
forms of a fundamental duality. These operational modes are also reinterpreted
in the context of the comprehension schema of axiomatic set theory ZF. This
leads us to develop how Kolmogorov's complexity is linked to intensionality,
abstraction, classification and information system.Comment: 43 page
Types and Intermediate Representations
The design objectives and the mechanisms for achieving those objectives are considered for each of three systems, Java, Erlang, and TIL. In particular, I examine the use of types and intermediate representations in the system implementation. In addition, the systems are compared to examine how one system\u27s mechanisms may (or may not) be applied to another
- âŠ