Functional programming and embedded systems

Embedded computer systems seem to be the antithesis of functional language systems. Embedded systems are small, stand-alone, and are often forced to accept inelegant design compromises due to hardware cost. They run continuously and are reactive, that is, their primary goal is to monitor sensors and control effectors, using observed external events to trigger state-changing control actions. Yet this thesis describes how functional abstraction can tame the inelegance of embedded systems. Architectural compromises can be made in device drivers, programmed within the functional language, but a function-level interface is presented to the application programmer. Four modifications are introduced to a test-bed purely-functional language in order to facilitate embedded-systems programming: I/O register access; communicating processes; interrupts; and a real-time incremental garbage collector. Referential transparency is preserved. The conventional model of communicating processes is augmented by the use of type classes and constructor classes to add type security around message-passing. Two case studies of embedded applications are programmed: a marble-sorter and a liftshaft. Both give encouraging results for the adequacy of the approach. Two important areas are identified for future research. (1) It is not clear to what extent lazy evaluation is a help or a hindrance in programming embedded systems. (2) Real-time expression and guarantees of schedulability would extend the attractiveness of functional languages still further.

[1]  Henry G. Baker,et al.  List processing in real time on a serial computer , 1978, CACM.

[2]  Ian Holyer,et al.  Concurrency in a purely declarative style , 1993 .

[3]  Manfred Broy,et al.  Applicative Real-Time Programming , 1983, IFIP Congress.

[4]  John Hughes,et al.  Why Functional Programming Matters , 1989, Comput. J..

[5]  Joe Armstrong,et al.  Concurrent programming in ERLANG , 1993 .

[6]  Mats Carlsson,et al.  FUDGETS: a graphical user interface in a lazy functional language , 1993, FPCA '93.

[7]  Roger B. Dannenberg,et al.  Arctic: A Functional Language for Real-Time Systems , 1986 .

[8]  Gordon D. Plotkin,et al.  An Ideal Model for Recursive Polymorphic Types , 1986, Inf. Control..

[9]  Alan C. Shaw,et al.  Reasoning About Time in Higher-Level Language Software , 1989, IEEE Trans. Software Eng..

[10]  Thomas P. Jensen,et al.  Clock analysis of synchronous dataflow programs , 1995, PEPM '95.

[11]  C. A. R. Hoare,et al.  Communicating Sequential Processes (Reprint) , 1983, Commun. ACM.

[12]  P. C. Treleaven,et al.  PARLE Parallel Architectures and Languages Europe , 1987, Lecture Notes in Computer Science.

[13]  Simon L. Peyton Jones,et al.  Parallel Implementations of Functional Programming Languages , 1989, Comput. J..

[14]  William W. Wadge,et al.  Lucid, a nonprocedural language with iteration , 1977, CACM.

[15]  A. F. Sinclair,et al.  Functional Programming and Operating Systems , 1989, Comput. J..

[16]  Antony A. Faustini,et al.  Toward a Real-Time Dataflow Language , 1986, IEEE Software.

[17]  Henry Ledgard,et al.  Reference Manual for the ADA® Programming Language , 1983, Springer New York.

[18]  Paul Hudak,et al.  Haskore music notation – An algebra of music – , 1996, Journal of Functional Programming.

[19]  J. Michael Spivey,et al.  A Functional Theory of Exceptions , 1990, Sci. Comput. Program..

[20]  John McCarthy,et al.  Recursive functions of symbolic expressions and their computation by machine, Part I , 1960, Commun. ACM.

[21]  Mike Williams,et al.  Implementing a functional language for highly parallel real time applications , 1992 .

[22]  Graeme Smith,et al.  Temporal Logic and Z Specifications , 1989, Aust. Comput. J..

[23]  Colin Runciman Modula and a vision laboratory , 1981 .

[24]  Daniel P. Friedman,et al.  An indeterminate constructor for applicative programming , 1980, POPL '80.

[25]  P. J. Landin,et al.  Correspondence between ALGOL 60 and Church's Lambda-notation , 1965, Commun. ACM.

[26]  Hussein Zedan,et al.  TAM: A Formal Framework for the Development of Distributed Real-Time Systems , 1992, FTRTFT.

[27]  Edsger W. Dijkstra,et al.  A Discipline of Programming , 1976 .

[28]  Colin Runciman,et al.  Extending a functional programming system for embedded applications , 1995, Softw. Pract. Exp..

[29]  Simon Thompson Interactive functional programs , 1990 .

[30]  Geoffrey L. Burn,et al.  Evaluation transformers - a model for the parallel evaluation of functional languages (extended abstract) , 1987, FPCA.

[31]  A. Burns,et al.  Scheduling hard real-time systems: a review , 1991, Softw. Eng. J..

[32]  James M. Boyle,et al.  A practical functional program for the CRAY X-MP , 1992, Journal of Functional Programming.

[33]  Albert Benveniste,et al.  programmi language and its , 2001 .

[34]  D. H. Fijma,et al.  A case study in functional real-time programming , 1991 .

[35]  Chung Laung Liu,et al.  Scheduling Algorithms for Multiprogramming in a Hard-Real-Time Environment , 1989, JACM.

[36]  Nicolas Halbwachs,et al.  LUSTRE: A declarative language for programming synchronous systems* , 1987 .

[37]  A. C. Reeves,et al.  Gerald: An Exceptional Lazy Functional Programming Language , 1989, Functional Programming.

[38]  Jürgen Ebert,et al.  An Exception Handling Construct for Functional Languages , 1988, ESOP.

[39]  Alan Burns,et al.  Real-time systems and their programming languages , 1986, International computer science series.

[40]  John R. G. Cupitt The design and implementation of an operating system in a functional language (miranda) , 1989 .

[41]  Mark P. Jones Computing with Lattices: An Application of Type Classes , 1992, J. Funct. Program..

[42]  Mark P. Jones,et al.  The implementation of the Gofer functional programming system , 1994 .

[43]  Philip Wadler,et al.  Packrat parsing:: simple, powerful, lazy, linear time, functional pearl , 2002, ICFP '02.

[44]  William Stoye Message-Based Functional Operating Systems , 1986, Sci. Comput. Program..

[45]  Faron Moller,et al.  A Temporal Calculus of Communicating Systems , 1990, CONCUR.