Wednesday, September 15, 2010

PASCAL

HISTORICAL VIGNETTE
Complexity has and will maintain a strong fascination for many people. It is true that we live in a complex world and strive to solve inherently complex problems, which often do require complex mechanisms. However, this should not diminish our desire for elegant solutions, which convince by their clarity and effectiveness. Simple, elegant solutions are more effective, but they are harder to find than complex ones, and they require more time, which we often believe to be unaffordable. (Niklaus Wirth, Turing Award Lecture, 1984) [Wirth, 1985].

During the mid- to late sixties, ALGOL was the focus of much attention in the world of computer programming. Niklaus Wirth was in the midst of it all, working on improved version of ALGOL 60 at the ETH laboratory in Zurich. The need for a successor versions of ALGOL had become apparent after the release of the Revised Report.
Although it contained many briliant conceptual ideas, the language lacked sech practical capabilities as character variables and I/O. Wirth and Tony Hoare, of Oxford University, but both at Stanford University at the time, suggested to the ALGOL committe several modest but important improvements to ALGOL 60. The ideas were rejected and the successor became the overly complex ALGOL 68. Wirth, refusing to be daunted by a closed-minded committee, developed his own successor to ALGOL 60, called ALGOL-W. During the next four years, with the help of three assistants, he developed a successor to that language, which came to be known as Pascal, after Blaise Pascal, the French mathematican, scientist, and religious writer.

Pascal is in many ways an elegant version of ALGOL 60. "Like ALGOL 60, the standard Pascal language contains all the code necessary for implementation on computers" [Baron, 1986]. It is both beatiful and practical. Wirth had designed Pascal with the following two goals in mind [Cooper, 1983]:

  1. To provide a teaching language that would bring out concepts common to all languages while avoiding inconsistencies and unnecessary detail
  2. To define a truly standard language that would be cheap and easy to implement on any computer
These goals have been realized. Many universities and colleges teach Pascal as a first programming language, and it has been the language used for the AP Computer Science Exam for high school students (though they are switching to C++). That Pascal is a structured language has alot to do with is popularity in the world of education. According to Wirth, programs are designed "according to the same principles as electronic circuits, that is, clearly subdivided into parts with only  a few wires going across the boundaries" [Wirth, 1985]. He believes that students should program this way, especially in the beginning of their education, because "the language in which the student is taught to express his ideas profoundly influences his habits of thought and invention" [Jensen, 1974].

An important milestone in the history of Pascal occured when Kenneth Bowles developed a Pascal compiler and operating system for use on mini- and microcomputers, including a text editior, assembler, and linker. This system is UCSD (University of California at San Diego) Pascal and was distributed to educational institutions as well as industry. Since 1984, interpreted versions and the fast turbo Pascal have added to its popularity. Wirth, however, has moved on to newer interst, in particular, concurrent programming.
Niklaus Wirth's tenacious adherence to an elegant and strict programming discipline has made him one of the major architects of computer science. In this 1984 Turing Award Lecture he stated, "The subject [computer languages] seemed to consist of 1 percent science and 99 percent sorcery the conceptual framework of computer science and will continue to influence it for years come.

Philosophy and Structure
Wirth's purpose in designing Pascal [Wirth, 1971] were to:

  1. Allow the systematic and precise expression of programming concepts and structure
  2. Allow systematic program development
  3. Demonstrate that a language with a rich set of flexible data and program structuring facilities can be implemented efficiently
  4. Demonstrate that the use of a machine-independent language with flexible data and program structures for compiler writing leads to an increase in the compiler's readibility, verifiability, and consequently its reliability, without loss of efficiency
  5. Help gain more insight into methods of organizing large programs and managing software projects
  6. Have extensive error-checking facilities and thus be a good vehicle for teaching programming.
Thus Pascal was not envisioned as aproduction language, but as an experimental and teaching language. The DOD's selection of Pascal as the basis for Ada gives evidence to Wirth's attaining his goals.
A Pascal program is block-structured, with nesting allowed to any depth, but in a special way. Its form is:

program name(list of file identifiers);
   label declarations
   constant declarations
   type declarations
   variable definitions
   program body enclosed by begin....end.


The list of  procedure and function definitions may be long indeed, separating the main program's variable list from its body. One might need to look back several pages of source cide to find just what the range of indexType is, or whether x is real or integer valued. Local blocks encapsulating a section of related code are not  a part of Pascal. Each block must be either a procedure, function, the main program block, or a statement block, such as a for or while construction. This structure is simple, but encourages global variables or variables with unnecessarily large scope.

No comments:

Post a Comment