A Literate Programming Tool for Concurrent Clean

Literate programming has attracted some interest in the functional programming community. This paper presents a prettyprinting algorithm used in a literate programming tool for the functional language Concurrent Clean, and discusses some of the issues involved in prettyprinting layout based languages. 1 Literate programming This section introduces the concept of literate programming for those who are unfamiliar with it, and makes some suggestions as to the merits of literate programming. There is some coverage of the topic from the point of view of functional programming, which is the authors primary interest. 1.1 What is literate programming? Literate programming is a style of programming introduced by Donald Knuth in his book of the same name [2]. The central idea of literate programming is: Instead of imagining that our main task is to instruct a computer what to do, let us concentrate rather on explaining to human beings what we want a computer to do.[7] The exact features of the various literate programming systems vary, but they have a number of common features. 1. They all provide some mechanism for writing both code and documentation in a single file, and extracting the program code in a form suitable for compilation. 2. Most provide some form of automatic indexing of the program code. The tools construct an index of identifiers and code fragments, and generate cross reference information. 3. Most systems provide some mechanism for reordering the program code, so that it can be presented in way the author wishes, rather than in the order which the compiler requires. Tools are used to automatically reorder the code for the compiler.

[1]  C. Pollard,et al.  Center for the Study of Language and Information , 2022 .

[2]  Carroll Morgan The Refinement Calculus, and Literate Development , 1993, Formal Program Development.

[3]  Donald E. Knuth,et al.  Literate Programming , 1984, Comput. J..

[4]  Richard S. Bird,et al.  Introduction to functional programming , 1988, Prentice Hall International series in computer science.