Advertisement

Using π-RED as a teaching tool for functional programming and program execution

  • Werner E. Kluge
  • Carsten Rathsack
  • Sven-Bodo Scholz
From Transistors to Computer Architecture
Part of the Lecture Notes in Computer Science book series (LNCS, volume 1022)

Abstract

This paper describes an interactively controlled reduction system π-redwhich may be employed to teach both basic concepts of functional programming and program execution at the undergraduate level, and advanced topics of computer science at the graduate level.

π-redsupports the reduction languages KiR — a sugared versions of an applied λ-calculus with a full-fledged (type-free) β-reduction. Functions (λ-abstractions) are truly treated as first class objects: they may be applied to other functions or to themselves, and λ-abstractions may be computed as function values. Name clashes are resolved by an indexing scheme similar to de Bruijn indices.

Programs may be executed in a stepwise mode and intermediate programs may be displayed in high-level notation.

Special pattern matching constructs provide the means to directly specify in KiR complex term rewrite systems. In conjunction with the stepwise execution mode, this feature has been extensively used, in lab courses accompanying graduate courses on computer architecture, to rapidly prototype and study various programming and (abstract) machine models, compilation schemes, type checkers, etc.

Keywords

Pattern Match Program Execution Functional Programming Abstraction Lambda Argument Term 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. [AbSus85]
    Abelson, H.; Sussmann, G.J.: Structure and Interpretation of Computer Programs, MIT Press, McGraw-Hill, New York, NY, 1985Google Scholar
  2. [Back78]
    Backus, J.: Can Programming Be Liberated from the von Neumann Style? A Functional Style and Its Algebra of Programs, Communications of the ACM, Vol. 21, No. 8, 1978, pp. 613–641Google Scholar
  3. [Berk75]
    Berkling, K.J.: Reduction Languages for Reduction Machines, Proceedings of the 2nd Annual Symposium on Computer Architecture, 1975, ACM/IEEE 75CH0916-7C, pp. 133–140Google Scholar
  4. [BeFe82b]
    Berkling, K.J.; Fehr, E.: A Consistent Extension of the Lambda-Calculus as a Base for Functional Programming Languages, Information and Control, Academic Press, Vol. 55, Nos. 1–3, October/November/December 1982Google Scholar
  5. [Car83]
    Cardelli, L.; McQueen, D.: The Functional Abstract Machine The ML/LCF/HOPE Newsletter, AT&T, Bell Labs, Murray Hill NJ, 1983Google Scholar
  6. [Brui72]
    DeBruijn, N.G.: Lambda-Calculus Notation with Nameless Dummies. A Tool for Automatic Formula Manipulation with Application to the Church-Rosser-Theorem, Indagationes Mathematicae, Vol. 34, 1972, pp. 381–392Google Scholar
  7. [GaK194]
    Gaertner, D., Kluge, W.E.: π-red +: An Interactive Compiling Graph Reduction System for an Applied λ-Calculus, to be published in JFPGoogle Scholar
  8. [Gol94]
    Goldson, D.: A Symbolic Calculator for Non-Strict Functional Programs The Computer Journal, Vol. 37, No. 3, 1994, pp. 177–187Google Scholar
  9. [HaMiTo88]
    Harper, R.; Milner, R.; Tofte, M.: The Definition of Standard ML Version 3, Laboratory for Foundations of Computer Science, University of Edinburgh, May 1989Google Scholar
  10. [HuWa88]
    Hudak, P.; Wadler, P. (Editors) et al.: Report on the Functional Programming Language: Haskell, Draft Proposed Standard, December 1988, Yale UniversityGoogle Scholar
  11. [John83]
    Johnsson, T.: Efficient Compilation of Lazy Evaluation SIGPLAN Compiler Construction Conference, Montreal Queb., 1984Google Scholar
  12. [Klu92]
    Kluge, W.E.: The Organization of Reduction, Data Flow, and Control Flow Systems, MIT Press, Cambridge, Mass., 1992Google Scholar
  13. [Klu94]
    Kluge, W.E.: A User's Guide for the Reduction System π-Red, Int. Report, No. 9419, Inst. f. Informatik, CAU Kiel, 1994.Google Scholar
  14. [Lan64]
    Landin, P.J.: The Mechanical Evaluation of Expressions, The Computer Journal, Vol. 6, No. 4, 1964, pp. 308–320Google Scholar
  15. [Lavi87]
    Laville, A.: Lazy Pattern Matching in the ML Language, INRIA Rapporte de Recherche, No. 664, 1987Google Scholar
  16. [Plas93]
    Plasmeijer, R., van Eekelen, M.: Functional Programming and Parallel Graph Rewriting, Addison Wesley, 1993Google Scholar
  17. [Pey87]
    Peyton-Jones, S.L.: The Implementation of Functional Programming Languages, Prentice Hall, Englewood Cliffs, NJ, 1987Google Scholar
  18. [Pey92]
    Peyton-Jones, S.L.: Implementing Lazy Functional Languages on Stock Hardware: The Spineless Tagless G-Machine, Journal of Functional Programming, Vo. 2, No. 2, 1992, pp. 127–202Google Scholar
  19. [RuToFi93]
    Runciman, C.; Toyn, I.; Firth, M.: An Incremental, Exploratory and Transformational Environment for Lazy Functional Languages, Journal of Functional Programming, Vol. 3, No. 1, 1993, pp. 93–115Google Scholar
  20. [Turn76]
    Turner, D.A.: A New Implementation Technique for Applicative Languages Software Practice and Experience, Vol. 9, No. 1, 1979, pp. 31–49Google Scholar
  21. [Turn86]
    Turner, D.A.: An Overview of Miranda, SIGPLAN Notices, Vol. 21, No. 12, 1986, pp. 158–166Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 1995

Authors and Affiliations

  • Werner E. Kluge
    • 1
  • Carsten Rathsack
    • 1
  • Sven-Bodo Scholz
    • 1
  1. 1.Institut fuer InformatikChristian-Albrechts-Universitaet KielKielGermany

Personalised recommendations