Top Banner
History of Computer Languages Krishna Chandra singh,
33

Computer history krishna

Jan 24, 2017

Download

Engineering

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Computer history krishna

History of Computer Languages

Krishna Chandra singh,

Page 2: Computer history krishna

Why Study History• Today’s languages are only explicable by examining how

they grew up– For example, must look at their development to understand why

FORTRAN and COBOL are still in use after more than 40 years– Also must see how C happened to understand why the syntax is the

way it is• To pinpoint some past errors and “prevent history from

repeating itself”– That’s what they always say, but history repeats itself anyway!– In programming languages, the microprocessor-based languages

had the same troubles that big machine language had decades ago

Page 3: Computer history krishna

Early Machines• Early language were called order codes or

instruction codes• Were very primitive, even compared to assembly

languages• Used numbers for memory locations as well as

operation codes (opcodes)!• No I/O or primitive I/O instructions• Loops were primitive jumps or not much better• Libraries were inserted into the programs that

use them, not called as subroutines

Page 4: Computer history krishna

FORTRAN• Stands for “The IBM Mathematical FORmula

TRANslating system”• John Backus was team leader• First manual 1956• First successful compiler 1958• Took 18 person-years to write compiler!• Motivating factor behind the language was the economy,

not the beauty of programming in a mathematical notation– Programming and debugging costs exceeded running costs, and

were getting worse as computers became faster– The only solution seemed to be to design a language for

scientific computations that allowed programmer to use mathematical notation itself

– Must be done such that compiler could produce efficient object code

Page 5: Computer history krishna

FORTRAN Features• Assignment statements are scientific formulas of some

complexity• Comments allowed• DO loops are simple to write• Subroutines and function subroutines

– Call statements look like math formulas• Formats for I/O, much less painful than I/O on early

computers• Machine independence!• Early compilers were remarkably good• But still didn’t produce code as efficient as hand-coded

(machine language) code

Page 6: Computer history krishna

Reasons for FORTRAN’s Success

• Made efficient use of programmers’ time compared to assembly language

• Easy to learn, opened door to computer for non-specialist programmers

• Supported by IBM, soon to become the most powerful firm in computing.– IBM and FORTRAN grew together

• Right for scientific users, which is good because most applications and users were scientific at the time

Page 7: Computer history krishna

A FORTRAN Program• See code folder for the code itself• Needs open and close statements for this to work with

files instead of punched cards• The first 2 lines are comments• Arrays must be declared, with size given (3rd line)• Algol (later) allows array with variable bounds,

FORTRAN doesn’t• Most FORTRAN variables are declared implicitly by use• MEAN, however, was explicitly declared as real• If not declared, it would be integer since it started with a

letter between I and N.

Page 8: Computer history krishna

Problems related to FORTRAN

• Main problem being that programmers were reluctant to learn any other languages!

• They would use FORTRAN even when it didn’t have the appropriate features

• For example, people would use FORTRAN for – data processing (business) applications, and,– interactive computing!

Page 9: Computer history krishna

More FORTRAN Problems• No standard until 1966• FORTRAN 77, 1978

– From my own recollection, it had “else”– g77 on linux on CS01– File I/O via open and close stmts like in

our code example• FORTRAN 90, 1991

– Supports many new features• Allocation of space for arrays on block

entry!• Records• Modules• Pointers!!• Also allowed all old (FORTRAN 77)

features for legacy programs

Page 10: Computer history krishna

ALGOL (Algorithmic Language)

• As FORTRAN developed in the 50’s, many of the same people realized the importance of standardization

• Whereas FORTRAN was one company’s product (IBM), ALGOL was developed by a joint European-American committee

• FORTRAN was great for efficiency, ease of learning, and having a high-level language at all!

Page 11: Computer history krishna

ALGOL Goals• Should be as close as possible to standard math

notation• Readable without too much additional

explanation or even comments– Self-documenting code

• Can be used for describing computing processes (algorithms) in publications– A language for publication as well as for machine use

• Mechanically translatable into machine code (Of course!! But actually few Algol compilers seemed to exist!!)

Page 12: Computer history krishna

ALGOL Versions• ALGOL 58 was first version, never implemented!• ALGOL 60 was next; incorporated criticisms of

ALGOL 58• Report for the “60” was an important event in

history of computing• Revised report, 1963, was a classic• Why so much song and dance for a language

that was never popular (at least in the U.S.)?– Many concepts were introduced (next slide)

Page 13: Computer history krishna
Page 14: Computer history krishna

ALGOL Concepts• Language definition

– BNF was used to define the syntax for the first time– This concept led to syntax-directed compilers

• Structured– Was the original block-structured language!– Variables weren’t visible outside the block in which they were declared

• Arrays can have variable bounds at compile time– Bounds must be fixed when entering block in which the array was

declared at run time– Can even have bounds like a[m:n, p:q], or complicated expressions for

the bounds• Contained several structured control statements

– if-else for, while (nesting OK), – Later some of these were exported to FORTRAN

• Recursion introduced for the first time!– Then thought to be useless “academic” concept– Couldn’t figure out how to compile them efficiently

Page 15: Computer history krishna

Reasons for ALGOL’s lack of success

• FORTRAN came out 2-3 years earlier than ALGOL 60, and programmers already got used to the former

• ALGOL had more features, and so was harder to learn

• IBM initially supported ALGOL, but since FORTRAN had lots of customers, IBM ignored ALGOL

• Great success of IBM in the 60’s boosted FORTRAN, and vice versa

• FORTRAN compilers were much simpler and produced faster code than ALGOL compilers

Page 16: Computer history krishna

ALGOL W (1966)• Essentially a tidying up of Algol 60 with several important

new features• Well liked by users, though there weren’t that many of

them• Developed by Niklaus Wirth (ETH) and C.A.R. Hoare• Records and references (pointers!)• Case statement• For statement conditions were more restricted and less

error-prone• Procedure and function parameters could be called:

– By value– By result– By value-result

Page 17: Computer history krishna

More ALGOL W Features

• Long real and complex data types allow storage and arithmetic on long real and complex numbers!

• Bits datatype for low-level processing!• Some string facilities, but primitive• Assert statements allow assertions to be

tested during a run

Page 18: Computer history krishna

ALGOL 68• Goal was to come up with a core language with a

small number of powerful constructs– IBM’s PL/I, on the contrary, was very comprehensive

• Some of these constructs were so general that they were confusing – an overkill– Very general sequence generation for indices in loops

• Orthogonality was a major design goal– If a feature worked in one situation, it is likely to work in

other situations as well• Overall far too complicated to be successful

– Initial specification was so abstruse that simple guides were produced before even partial acceptance of the language

Page 19: Computer history krishna

Pascal

• Developed by Niklaus Wirth of the ETH in the late 60’s and early 70’s

• Built on his earlier work on Algol W• Meant primarily for teaching

– Structured programming• To beat FORTRAN, must have fast

compiler that generates efficient code• Became the primary teaching language in

the world by mid-80’s

Page 20: Computer history krishna

PASCAL features• Inclusion of features that encourage well-written and well-structured

program– Really meant for teaching– Data types are a prominent feature of Pascal

• Integer• Real• Boolean• Char• Enumeration types• Structured user-defined types include

– Arrays– Records– Sets– File

• Not rich in features for systems programming (bit-twiddling)– But some people used Pascal for systems programming anyway!

Page 21: Computer history krishna

Business DP Languages• COBOL was the major one, still in use today!• Grace Hopper was the leader• DoD• Places strong emphasis on data and file

processing• Credited with the idea of “record” although

ALGOL W also had that.• Looks boring to scientific programmers• Verbose, supposedly to seem natural to

business data processing people

Page 22: Computer history krishna

General or multipurpose languages

• There used to be a clear distinction between business and scientific programmers

• Even in the late 50’s and early 60’s, language designers started to work on integrating scientific and business languages

• First was JOVIAL (Jules’ Own Version of the International Algebraic Language (ALGOL 58))

• But PL/I was the main language in this category

Page 23: Computer history krishna

PL/I

• Supported by IBM• Was to replace FORTRAN and COBOL• Combined ideas from these languages, as

well as ALGOL (block structure), LISP (list processing, and others

• Designed by a committee of IBMers and users

Page 24: Computer history krishna

More on PL/I

• How do you make a language big but supposedly not overwhelming to learn?

• “Default” was key idea– Everything has a default way of being– If you were just learning a feature, you might not have even known other

options existed• When IBM wanted to quit FORTRAN and COBOL support and go for

PL/I, customers protested. – PL/I died, and the two older languages lived.

• See PL/I example in book.• However PL/I also has string and file processing capabilities, making it

useful for business DP as well– More concise syntax than COBOL

Page 25: Computer history krishna

Developing Programs Interactively• FORTRAN, COBOL, and ALGOL (and especially

PL/I!) were slow to compile in those days• BASIC was invented at Dartmouth College in the

mid 60’s by Kemeny and Kurtz• BASIC was easy to compile and learn by students

and non-experts• Easy enough to type on terminals (which were

frustrating things even in the mid 70’s)• Simple enough to compile even in the new

microcomputers of the 70’s– BASIC caught on in a big way– Microsofts’ VB was based on an OO-extension of BASIC

Page 26: Computer history krishna

APL• Designed by Iverson as a mathematical language• For concise description of math algorithms• Originally contained a large number of operators• Trimmed down once implemented, but still very

rich• Was once a highly-respected language• APL has a large alphabet, and these unusual

characteristics:– The primitive objects are arrays (lists, tables, or

matrices)– It’s an operator-driven language, branches not used

much– No operator precedence, just left to right

Page 27: Computer history krishna

Special-Purpose Languages

• String manipulation languages– COMIT– SNOBOL

• List-processing languages– IPL-V– LISP

Page 28: Computer history krishna

Principal Features of LISP• Performs computations with symbolic expressions more

than with numbers– Good for AI

• Represents symbolic expressions and other info in the form of list structures in memory

• Uses small set of constructor and selector operations to create and extract info from lists– These operations are expressed as functions and use the

mathematical idea of the composition of functions as a means of constructing more complex functions

• Recursive control is more natural than iterative control!!– Very controversial in the old days

• Data and program are equivalent forms. Thus programs can be easily modified like data!– Idea of automatic programming

Page 29: Computer history krishna

Other LISP features

• Probably the first language to implement garbage collection!

• Close to a pure functional language– Has as its fundamental operation the

evaluation of expressions• Interactive• ELEGANT – helped lead to its survival

Page 30: Computer history krishna

Simulation Languages• Used for simulating discrete systems

– Among the first problems solved by computers– These simulations involve complex discrete or discretized systems– Traffic simulation, for example

• GPSS – first widely-used simulation language– First described in 1961– Available to programmers a bit later– Based on block diagrams– Made it easy to develop simulation models (programs) but slow to

execute, at least in those days• SIMULA

– Developed in the 60’s at the Norwegian Computing Centre (Dahl and Nygaard)

– Simula ’67 was the best known version– Based on Algol ’60 with one very important addition, the CLASS

concept!• Became key concept in modern object-oriented programming!• Could be called the first object-oriented programming language

Page 31: Computer history krishna

Scripting languages• Arose out of batch files, batching commands together• One common task in programming is to analyze or convert text from one

form to another• In these tasks, pattern matching is important• Special-purpose languages such as awk was developed for these

purposes• UNIX shell scripts• Perl combined power of awk with C-like syntax for better general

programming• Perl has grown into a very large language with object-oriented and Web

programming support• Often, a Web client and server need to communicate with each other• This is done through what’s known as the Common Gateway Interface

(CGI)• Perl is one of the most popular languages for writing CGI scripts.

– Other languages for that purpose include Python Tcl, and Javascript– Can also write CGI scripts in more conventional languages but it’s less

convenient to do so

Page 32: Computer history krishna

Perl Variables• Variables are typeless, but are classified as

scalar, array, or hash• Scalar (prefix $)

– Number, always stored as double precision numbers– String

• Array (prefix @)• Hash or associative array (prefix %)

– %month = (“April” => 30, “May” => 31, “June” => 30);– $month(“July”) = 31;– Note the $!!

Page 33: Computer history krishna

Perl Pattern Matching

• Just like ed in UNIX• To change “Hi, there” to “Hello there” write

$string1 =~ s/I,/ello/;Then the statement$string2 =~tr/a-m/A-M/;Will transform each lowercase letter in the

range a-m to their uppercase counterpart!