429 research outputs found
Implementing and reasoning about hash-consed data structures in Coq
We report on four different approaches to implementing hash-consing in Coq
programs. The use cases include execution inside Coq, or execution of the
extracted OCaml code. We explore the different trade-offs between faithful use
of pristine extracted code, and code that is fine-tuned to make use of OCaml
programming constructs not available in Coq. We discuss the possible
consequences in terms of performances and guarantees. We use the running
example of binary decision diagrams and then demonstrate the generality of our
solutions by applying them to other examples of hash-consed data structures
Multiple-View Tracing for Haskell: a New Hat
Different tracing systems for Haskell give different views of a program at work. In practice, several views are complementary and can productively be used together. Until now each system has generated its own trace, containing only the information needed for its particular view. Here we present the design of a trace that can serve several views. The trace is generated and written to file as the computation proceeds. We have implemented both the generation of the trace and several different viewers
Controlling fine-grain non-numeric parallelism on a combinator-based multiprocessor system
We have developed a scheme to extend the SASL programming language and its run-time system for fine grain parallel processing. The proposed scheme provides a mechanism that can override the original lazy semantics by augmenting proper eager information. This information is first annotated in SASL programs and then translated to the combinator control tags by a new set of optimization rules. The effectiveness of this scheme has been evaluated through the simulation of a set of symbolic-oriented programs on an idealized shared-memory system. The results show that a considerable amount of parallelism can be extracted from a wide variety of application programs
Tracing and Debugging of Lazy Functional Programs - A Comparative Evaluation of Three Systems
In this paper we compare three systems for tracing and debugging Haskell programs: Freja, the Redex Trail System and Hood. We identify the similarities and differences of these systems and we evaluate their usefulness in practice by applying them to a number of small to medium programs in which errors had deliberately been introduced
Lazy functional parser combinators in Java
A parser is a program that checks if a text is a sentence
of the language as described by a grammar. Traditionally, the program
text of a parser is generated from a grammar description, after which it is
compiled and subsequently run. The language accepted by such a parser
is, by the nature of this process, hardcoded in the program. Another
approach, primarily taken in the context of functional languages, allows
parsers to be constructed at runtime, thus dynamically creating parsers
by combining elements from libraries of higher level parsing concepts; this
explanins the the name "parser combinators". Efficient implementation
of this concept relies heavily on the laziness that is available in modern
functional languages [13, 14]. This paper shows how to use parser combinators
in a functional language as well as Java, and shows how parser
combinators can be implemented in Java. Implementing parser combinators
is accomplished by combining two libraries. The first one, written
in Haskell, defines error-correcting and analysing parser combinators [2].
The second one consists of a small Java library implementing lazy functional
behavior. The combinator library is straightforwardly coded in
Java, using lazy behavior where necessary. In this paper all three aspects,
the two libraries and its combination, are explained
Combinator evaluation of functional programs with logical variables
technical reportA technique is presented that brings logical variables into the scope of the well known Turner method for evaluating normal order functioned programs by S, K, I combinator graph reduction. This extension is illustrated by SASL+LV, an extension of Turner's language SASL in which general expressions serve as formal parameters, and parameter passage is done by unification. The conceptual and practical advantages of such an extension are discussed, as well as semantic pitfalls that arise from the attendant weakening of referential transparency. Only four new combinators (LV, BV, FN and UNIFY) are introduced. The resulting object code is fully upward compatible in the sense that previously compiled SASL object code remains executable with unchanged semantics. However, "read-only" variable usage in SASL-f LV programs requires a "multi-tasking" extension of the customary stack-based evaluation method. Mechanisms are presented for managing this multi-tasking on both single and multi-processor systems. Finally, directions are examined for applying this technique to implementations involving larger granularity combinators, and fuller semantic treatment of logical variables (e.g. accommodation of failing unifications)
Parallel programming using functional languages
It has been argued for many years that functional programs are well suited to parallel evaluation. This thesis investigates this claim from a programming perspective; that is, it investigates parallel programming using functional languages. The approach taken has been to determine the minimum programming which is necessary in order to write efficient parallel programs. This has been attempted without the aid of clever compile-time analyses. It is argued that parallel evaluation should be explicitly expressed, by the programmer, in programs. To do achieve this a lazy functional language is extended with parallel and sequential combinators.
The mathematical nature of functional languages means that programs can be formally derived by program transformation. To date, most work on program derivation has concerned sequential programs. In this thesis Squigol has been used to derive three parallel algorithms. Squigol is a functional calculus from program derivation, which is becoming increasingly popular. It is shown that some aspects of Squigol are suitable for parallel program derivation, while others aspects are specifically orientated towards sequential algorithm derivation.
In order to write efficient parallel programs, parallelism must be controlled. Parallelism must be controlled in order to limit storage usage, the number of tasks and the minimum size of tasks. In particular over-eager evaluation or generating excessive numbers of tasks can consume too much storage. Also, tasks can be too small to be worth evaluating in parallel. Several program techniques for parallelism control were tried. These were compared with a run-time system heuristic for parallelism control. It was discovered that the best control was effected by a combination of run-time system and programmer control of parallelism.
One of the problems with parallel programming using functional languages is that non-deterministic algorithms cannot be expressed. A bag (multiset) data type is proposed to allow a limited form of non-determinism to be expressed. Bags can be given a non-deterministic parallel implementation. However, providing the operations used to combine bag elements are associative and commutative, the result of bag operations will be deterministic. The onus is on the programmer to prove this, but usually this is not difficult. Also bags' insensitivity to ordering means that more transformations are directly applicable than if, say, lists were used instead.
It is necessary to be able to reason about and measure the performance of parallel programs. For example, sometimes algorithms which seem intuitively to be good parallel ones, are not. For some higher order functions it is posible to devise parameterised formulae describing their performance. This is done for divide and conquer functions, which enables constraints to be formulated which guarantee that they have a good performance. Pipelined parallelism is difficult to analyse. Therefore a formal semantics for calculating the performance of pipelined programs is devised. This is used to analyse the performance of a pipelined Quicksort. By treating the performance semantics as a set of transformation rules, the simulation of parallel programs may be achieved by transforming programs. Some parallel programs perform poorly due to programming errors. A pragmatic method of debugging such programming errors is illustrated by some examples
Computation in director string calculus
In this thesis we introduce a modified version of Director String Calculus (MDSC) which preserves the applicative structure of the original lambda terms and captures the strong reduction as opposed to weak reduction of the original Director String Calculus (DSC). Furthermore, our reduction system provides an environment which supports the nonatomic nature of substitution operation and hence can lend itself to parallel and optimal reduction. We shall compare our reduction method with other reduction methods, and discuss some of the advantages and disadvantages of our method
- …