Prologue
This textbook is the final product that I re-organized, with supporting materials, from the lecture notes for the“Advanced Programming Languages” in the department of computer science and engineering at Jeonbuk National University in Korea since 1996.
While developing the materials for the textbook, there were some thoughts that I could not get rid of. Among the thoughts, there were two most critical ones: 1) the inner blame why I had been so indifferent for systematic and theoretical study for such languages in the book so a long time, and 2) the regret why I had not published this kind of the book earlier far years before. The reason for the blame and the regret is as follows.
The time for me to attract to programming was about the second semester of the junior year at Penn State when I was learning Assembly Languages. Vividly, if I recall, it was about the time when I was performing the final project for the course by constructing sort, search, and other operations using binary trees with the IBM3070 assembly language, instructed by a middle-aged lady professor from IBM. The project provided me with a chance to realize how critically important the correctness of the computing systems, as well as how admiral such systems were. Not allowing a “bit” of error for the operations at the registers and memory of the IBM 3070 computer, represented in the assembly language was so valuable experience. The situation that I had to reflect the proper size and locations of the inputs and output for the recursive functions using the operation on the binary trees by calculating the exact sizes and locations of all the data with respect to the definition of their structures allowed me to feel some unmeasurable and incomprehensible achievement that I could not obtain from other projects in other courses.
The experience of performing the project with the assembly language in the course provided me with some sort of sound ability and solid confidence to perform successfully the highly challenging projects of Operating Systems (OS) and Compiler at Penn State in the following first semester of the senior year. Especially, both the OS project using the fork system function and the socket and pipe communication mechanisms to develop a mini OS for an editor for multiple concurrent users and the Compiler project using Lex and Yacc to develop a mini C Compiler made me feel such ability and confidence in pride as some kind of the achievement. I still have the felling of joy, with my heart, getting from the moment of executing properly, as planned, at the end of the OS project, the C/Unix program that two users logged in at two independent terminals concurrently and were able to exchange texts and documents each other, and from the moment of executing properly, as planned, the Yacc/Lex program that a simple C program was compiled and executed on Unix as expected.
We made a number of legends for such moments in the computer labs during the competitive project periods on the campus, mostly, after the mid-term exams. I still canimagine the colleagues, including myself, at the computer labs, who had spent nights until dawns in competition while coding such programs.
However, I in such a pride encountered the most difficult time in the university during the second semester of the senior year, which was caused by Prolog and List in the AI course at Penn State. The languages were totally different from those I had learned before the semester. Especially the achievement and the pride I got from the previous projects were totally destroyed by a single project to develop a Lisp interpreter with List language itself, in the course.
I barely was able to finish the course for graduation with the inductive reasoning learned from some mathematical courses, but I was so suppressed and distracted due to the fact that there were such languages, like Prolog and List, that I could not perform the project throughly even with understanding of Logic and Descret Mathematics. However a chance to overcome the problem came to me unexpectedly like an heavenly opportunity.
I had a chance to go to a graduate school, that is, Moore School at Penn, after graduation from Penn State. And I had a chance to learn a new language, namely, ML, from a young professor at the “Theory of Programming Languages” course. Until that time, I did not have any knowledge of the ML language at all.
I am sure that I had the first experience of learning the programming languages in the theoretical perspective from ML at Penn. And I learned, as a systematic and structural experience, validity that there are a set of different language paradigms and that the languages of the paradigms are due to be used for the purpose of the paradigms. Among the experiences, I could understand the linguistic complexity of ML, from the actual coding, that is, performing a heavy loaded project, that ML is of multi-paradigms. This experience provided me with a so valuable opportunity to comprehend the functional, logical and the object-oriented paradigms of ML in terms of linguistic perspective of the programming languages. Personally the opportunity became the academic foundation and actualization that I could overcome systematically and structurally the suppression and depression I had gotten from the Prolog and Lisp languages in the AI course during my last semester at Penn State. I am sure that the final project of the Theory of Programming Languages of developing a Scheme Interpreter with ML was the most innovative, as well as, the most challenging project I ever experienced up to the present time – and I truly expressed my sincere gratitude to Prof. Carl Gunter through this Prologue.
After this period of the experience, actually, my programming activities over 30 years were, mainly, related to and with those of a scientist and a professor in profession. Those can be summarized to be of developing the SRE (Software Re/everse-engineering Environment) tool in the field of the SW Re/Reverse Engineering in the practical perspective, and the SAVE (Specification, Analysis, Verification and Evaluation) tool based on dTP-Calculus in the field of the SW Forward Engineering in the theoretical perspective. If we consider that the former was a kind of an activity for a SW development methodology based on Meta-Programming, the latter can be considered to be a kind of an activity for a modeling and simulation methodology which can be applied to modelling, analysis and verification of computer systems and theis software with the Process Algebra theory. And, if I recall, I can say, without any hesitation, that the most valuable and helpful experience that I got for the activities is the experience of ML I learned from Prof. Carl Gunter.
Perhaps, because of the experience, I used to teach ML as a primary language, supported by the related languages, such as, Scheme, Prolog and Smalltalk, in the “Advanced Programming Languages” course in Jeonbuk University since 1996 up to the present. In general, it is not easy to learn Scheme, Prolog and Smalltalk independently. However, it is not difficult to learn these languages after learning the ML language in respect to its multi-paradigms perspective. The reason for such a convenience is that the main characteristics of these languages can be comprehended in the perspective of the multi-paradigms perspective of the ML language.
Definitely, the goal of this textbook is on this perspective. The textbook shows the basic features of the ML language and interprets them in the perspective of the multi-paradigms. And it also extends the interpretation and applies the extended to the representative language of each paradigms. That is, it is allowed to experience how the basic features of the ML language can be interpreted to the representative languages of each paradigms in the perspective of the ML’s multi-paradigm. In this perspective, three different types of languages can be studied and learned at the same time while learning a main language, that is, ML, throughly.
In this objective, the book was leveled to be suitable for the Senior and Master students. And, with the balance to the theory, it is also throughly descried how the actual programs of ML and its related languages are executed step by step in the pictorial representation. Among these, the most emphasis was made on the execution of the recursive function based on inductive definition by describing their execution processes and steps in the pictorial and diagrammatic representations. That is, it is represented in the pictorial method that the correctness and preciseness from the underneath assembly languages are absolutely also required at the higher level of the functional and logical languages. With such representation, the book made it understandable concretely how the logic, that is, algorithms at the higher languages are integrated with their related data, as well as their structures, at the lower level, as one.
The book was organized as follows in this perspective:
1) Chapter 1: Principle of Programming
The notion of the programming languages is defined, and the types of the languages are classified into two groups: 1) the procedural languages based on the “how” approach, and 2) non-procedural ones based on the “what” approach. The issues in the principle are described in the perspectives of algorithms, their complexities, and execution structures, with the example of both the procedural and the non-procedural types of the languages. From the issues, the basic principles and related concepts of the programming languages are defined.
2) Chapter 2: Procedural Languages
The notion and basic characteristics of the procedural languages are defined with respect to Pascal and C. The basic elements, structures and controls of the languages are described with respect to Pascal and C. The definition, execution and application of the functions and procedures of the procedural languages are described.
3) Chapter 3: ML – Multi-Paradigm Programming Languages
The basic characteristics and elements of ML are described. The concepts of the basic function and the high-order function of ML are described. Especially, the curried function and the partial instantiation are described. The user-defined data structure and the recursive composite data structure are described. The reference and array methods to allow side-effect are described. The structure for the ML’s module system, that is, signature, is described. Three methods for the information hiding in ML are described. The basic definition and examples of the functor in ML are described. Especially, the high-order function, curried function and the partial instantiation in ML are represented in C for their definitions. In addition. the recursive structures and their related operations are represented in C, too. ML is also analyzed theoretically in order to describe ML itself in the perspectives of the functional, logical and the object-oriented programming languages.
4) Chapter 4: Paradigms of Programming Languages
Three types of the programming languages are described with respect to ML.
4.1) Section 4.1 Scheme
The basic characteristics and elements of Scheme, which is one of the best known and the most representative functional languages, are described in this section. Especially, the high-order procedure and the λ-procedure are described in detail. The Church Numerals and their related operations are represented in detail as examples, based on the λ-procedure. In addition, the numbers and operations are compared with ML and are converted into the ML functions.
4.2) Section 4.2: Prolog
The basic characteristics and elements of Prolog, which is the first logical language designed for Artificial intelligence, are described in this section. Especially, the fact and the inference rules as clause are described in detail. The logical execution model and the procedural execution model are described in detail in comparison. The basic definitions of the Substitution, Application, Composition, Unification of Prolog are described in detail. Through examples, it is described in the pictorial representation in detail how the specific query is satisfied based on the procedural execution model.
4.3) Section 4.2: Smalltalk
The basic characteristics and elements of Smalltalk, which is the first object-oriented language designed tp model real world, are described in this section. It is described that the basic elements of Smalltalk, that is, value, name, expression, etc., are objects, as we as that if-expression, while-expression and iteration, even class, are, too. Through the notions with the examples, it is shown that Smalltalk is very highly object-oriented compared to other ones, such as, C++, Java, etc.
I, as the author of the book, did not follow the basic structure of most of the programming language textbooks in the field of Computer Science.
As stated in the beginning of the prologue, I tried to demonstrate, in the pictorial representation, that the linguistic preciseness and correctness are required for each representative paradigm languages, that is, Scheme, Prolog and Smalltalk, in the perspective of the multi-paradigms programming language of ML, as shown that the preciseness and correctness were definitely required for the assembly language.
I am not sure how long, as well as, in which manner, I am going to conduct the lectures for the Advanced Programming Languages”course in Jeonbuk National University. However, simply, I really wish that there will be some moment, in the future, for the students who took the course for last 25 years to realize that the materials for the lectures of the course were basically and fundamentally based on those of this textbook.
I truly thanks Junsup Song for supporting me to collect some lecture materials for the book to be published in this form. In addition, I want to expression my gratitude to the JBNU Press for providing me the opportunity to publish the book as the 2029 Publication Supporting Project of JBNU.
1 Jan 2021
In the front of the sunset at the Hwa Mountain in Jeonju
Prof. Moonkun Lee
Division of Computer Science and Engineering
School of Engineering
Jeonbuk National University, South Korea