Implementing Functional Languages on Object-Oriented Virtual ...
Recommend Documents
Feb 6, 2012 - Contents. 1 What is a programming language implementation. 11 .... But of course, to talk with any authori
6 Feb 2012 ... Contents. 1 What is a programming language implementation. 11 .... The book is
different from traditional compiler books in several ways:.
Feb 6, 2012 - 1. to design and implement new programming languages, especially ..... page gives more information on thes
Dec 5, 2017 - Wiley: Testing Object-Oriented Software - David C. Kung, Pei Hsia, Jerry Gao ... Object-oriented programming increases software reusability, extensibility, ... Beginning Object · Oriented Programming · with C# by Jack Purdum.
ling the degree of static checking by annotating function parameters ... type-theoretic foundation for languages such as these with gradual ... However, such languages do not allow for programming ... we are still using dynamic typing for the value d
Application development on top of database systems is heavily based on the .... addressability to tuples stored in the database (one tuple at a time), fetch data ...
where each variant (respectively) represents a production in the syntax E of the .... grams, operations to build ASTs (using constructors like Var, Lam, etc), or the.
Categories and Subject Descriptors: D.3.2 [Programming languages]: ...... efficiency is thus lower than that of Cohen's display (Appendix D.1, page Appâ24).
The Netherlands email: [email protected] ..... Circular Programs sibly nested) HTML style tables, as described by the following grammar: table .... these domains: all it does is recognising the structure of a table and composing the recognized ...
Adelard, one year later. Available online at http://www.javaworld.com/javaworld/javaone00/ j1-00-adelard.html, 2000. [20] World Wide Web Consortium.
DOMAIN-SPECIFIC LANGUAGES OFFER A SOLUTION TO THE PERFORMANCE AND THE. PRODUCTIVITY .... generator. Adopt front end from highly expressive embedding language. Customize ..... The scheduling algorithm attempts to ...
basic features for a tool-supported service management using extended seman- tic service ... tectures) especially by reconciling business requirements and IT ...
mer School 2013, Springer Lecture Notes in Computer Science volume ... The basics of our diagram DSL can be expressed in
from my lecture notes on Functional Programming for Domain-Specific. Languages [1] (p. 1â27 of Central European Functi
This white paper provides a detailed review of the technical aspects and ... 10g
and 11g on EMC® Symmetrix® VMAX™ arrays using Virtual Provisioning™. ....
Example of achieving higher Oracle database performance with automated ......
using AWR repo
a data-driven mechanism is used to activate threads, result data and .... merge, operations concerning each function call are merged into a single thread, and the ...
such a powerful help in developing reliable programs, without incurring runtime performance penalties, that we felt restricting our attention to such languages is ...
implementations of functional programming languages (Haskell and ML among them) with ... We settled on Standard ML of New Jersey (SML/NJ) because most.
[APS88] Annika Aasa, Ken Peterson, and Dan Synek. Concrete syntax for data objects in functional languages. In Proceedings of the 1988 ACM Conference on ...
Copy elimination is an important optimization for compiling func- ... other evaluation mechanisms by changing some definitions .... as follows: el 5 e2 if el 5 e2 if el, e2 E Targets - 6 el E Targets - G and e2 E G .... occur in the cat expression.
an eager, non-strict, mostly functional, implicitly parallel language and Sisal, an eager, implicitly parallel functional language designed to obtain high ...
Apr 6, 2007 - This is for several reasons: they have good run-time perfor- mance characteristics ... The Joy programming language (von Thun 2001) and the Factor ..... (Moore 1974), Desktop Calculuator (DC) (Morris and Cherry. 1978) ...
The motivating example comes from the C++ compiler Clang, which has an .... struct MetaString { typedef typename ... struct D. {. E* operator() (A*) { return 0; }. }; To create the automata we only need to enumerate the functions of our API with ...
Apr 28, 1998 - This thesis presents a technique for debugging lazy functional programs ..... today in many respects a mature technology. In a recent article, ...
Implementing Functional Languages on Object-Oriented Virtual ...
Hosting functional languages in object-oriented environments, such as the ... The syntax of Mondrian is unusual in that it looks more like Java [13] or C# [14] and ...
Implementing Functional Languages on Object-Oriented Virtual Machines Nigel Perrya and Erik Meijerb a
Department of Computer Science, University of Canterbury Christchurch, New Zealand [email protected] b
Microsoft Corporation
[email protected] Abstract Hosting functional languages in object-oriented environments, such as the Java Virtual Machine and Microsoft’s Common Language Infrastructure, so that they inter-operate well with other languages presents a number of problems. In this paper we introduce Mondrian, a functional language specifically designed for such environments, and describe the decisions and trade-offs in its design.
1
Introduction
Mondrian was originally conceived as a simple and consistent dialect of Haskell [1] which was defined by a translation into the latter. In its original description [2] mention was made as a footnote of using functional languages as glue for COM components as a possible domain where functional languages, such as Mondrian, could be shown to be superior. That first description also stated that Mondrian was still in its childhood stage. Mondrian has grown up, and metamorphised, over the intervening years. The original footnote became a more central goal in the design [3], the type system moved more towards those of object-oriented languages, the syntax changed to be more familiar to imperative programmers, it was targeted first at the JVM and then at .NET, and hopefully it retains some of the simplicity of its childhood. Mondrian, however, is still not finished, so in this paper we suggest it maybe is now approaching adulthood after an eventful adolescence. Mondrian is now a functional language specifically designed to be hosted on object-oriented virtual machines, such as the Java Virtual Machine (JVM) [4] and Microsoft’s Common Language Infrastructure (CLI) [5-7], and to inter-operate well with object-oriented languages. Executing on such machines raises problems for functional languages, especially if they wish to inter-operate well. The type systems and evaluation models of the two paradigms are rather different. The former provides a system based on sub-typing (inheritance), overriding (“polymorphism”) and strict evaluation. Functional languages are typically based on parametric polymorphism and non-strict evaluation. This paper describes the language, its implementation, and some of the decisions and trade-offs made in its design. The paper concentrates on the design and implementation of Mondrian. A description of Mondrian from a programmer’s viewpoint may be found in [8]. Similarities between Mondrian and languages such as Pizza [9], GL [10] and Generic C#/CLR [11] are evident. However, all these other approaches aim to extend the expressive power of object-oriented languages by introducing concepts more commonly found in functional languages. The contribution of Mondrian is that it takes an opposite approach, taking the functional paradigm and moulding it to fit better into the object-oriented framework. We believe this will introduce a whole new audience to functional languages, especially though our work with Microsoft and the .NET project.
2
An Overview Of Mondrian
The semantics of Mondrian will be familiar to functional programmers, it is a simple non-strict language. The I/O system is based on monads [12], and follows the design of Haskell [1]. A number of things however are unusual; including its syntax, the type system, exception handling, and concurrency support. We introduce here by example, later sections look at its type system and implementation in greater detail. 2.1
Basic Syntax
The syntax of Mondrian is unusual in that it looks more like Java [13] or C# [14] and less like traditional functional languages. This design was chosen to make the language more readily accessible to object-oriented programmers. Mondrian is also a minimalist1 language, rarely providing two ways of doing something, and often providing simpler expression forms than current functional languages. To introduce Mondrian, here is a simple function which calculates the roots of the quadratic equation ax2 + bx + c = 0: class Pair { r1 : Double; r2 : Double; } roots : Double -> Double -> Double -> Pair; roots = a -> b -> c let d = b * b - 4 * a * c; root = sqrt d; a2 = 2 * a; in if d < 0 then Pair(-1, -1) else Pair( (-b + root)/a2, (-b - root)/a2 );
The first line declares a product type, the syntax directly reflects Java/C#. However, the function definition is more of a mix of the two styles. To simplify the syntax the traditional “\” or fun/lambda keywords often used to introduce a functional definition have been dropped. However the qualified expression (let) and conditional (if/then/ else) forms follow traditional functional language design. The formation of a product value follows the typical constructor application syntax of object-oriented languages, however the traditional new keyword is redundant and has omitted2. 2.2
“Sum” Types and Pattern Matching
Rather than providing the traditional tagged sum type, Mondrian uses the class and sub-class mechanisms of the host virtual machine to provide similar functionality. In this model sub-type names replace tag names. For example, the standard list type can be defined in Mondrian using:
1
The language is named after Dutch abstract painter Pieter Cornelis Mondrian (1872 – 1944). In his later work Mondrian limited himself to small vertical and horizontal strokes.
2
Both Java and C# have retained ‘new’ though it is not required. The current Mondrian compiler optionally allows its use.