Ch 4 Software BIT 1003 Presentation 6 Contents
Ch. 4 Software BIT 1003 - Presentation 6
Contents �GENERATIONS OF LANGUAGES �COMPILERS AND INTERPRETERS �VIRTUAL MACHINES �OBJECT-ORIENTED PROGRAMMING �SCRIPTING LANGUAGES �FUNCTIONAL LANGUAGES �LANGUAGE DESIGN �LANGUAGE SYNTAX AND SEMANTICS 2
GENERATIONS OF LANGUAGES �Each computer is wired to perform certain operations in response to instructions. �An instruction is a pattern of ones and zeros stored in a word of computer memory. �By the way, a “word” of memory is the basic unit of storage for a computer. A 16 -bit computer has a word size of 16 bits, or two bytes. A 32 -bit computer has a word size of 32 bits, or four bytes. A 64 -bit computer has a word size of 64 bits, or eight bytes. �When a computer accesses memory, it usually stores or retrieves a word of information at a time. 3
instruction set - architecture �Each computer is wired to interpret a finite set of instructions. �Most machines today have 75 to 150 instructions in the machine “instruction set. ” �Much of the “architecture” of a computer design is reflected in the instruction set, and the instruction sets for different architectures are different. �For example, the instruction set for the Intel Pentium computer is different from the instruction set for the Sun SPARC. 4
The earliest computers �They were programmed directly in the machine instruction set. �The programmer worked with ones and zeros to code each instruction. �As an example, here is code (and an explanation of each instruction), for a particular 16 -bit computer. 011000000 (Load the A-register from 64) 0100000001 (Add the contents of 65) 01110000010 (Store the A-register in 66) 5
Assembly languages �An early improvement in programming productivity was the assembler. �Assembly languages are called second-generation languages. �An assembler can read mnemonics (letters and numbers) for the machine instructions, and for each mnemonic generate the machine language in ones and zeros. 6
These are typical of such mnemonics: LDA m ALS SSA JMP m Load the A-register from memory location m. Add the contents of memory location m to the contents of the Aregister, and leave the sum in the A-register. A Left Shift; shift the bits in the A-register left 1 bit, and make the least significant bit zero. Skip on Sign of A; if the most significant bit in the A-register is 1, skip the next instruction, otherwise execute the next instruction. Jump to address m for the next instruction. 7
FORTRAN �In 1954 the world saw the first third-generation language. �The language was FORTRAN, devised by John Backus of IBM. �FORTRAN stands for FORmula TRANslation. �example: X=Y+Z 8
procedural language �FORTRAN is a “procedural language”. �The computer is a flexible tool, and the programmer’s job is to lay out the sequence of steps necessary to accomplish the task. �The program is like a recipe that the computer will follow mechanically. 9
LISP (for LISt Processing) �In 1958, John Mc. Carthy at MIT developed a very different type of language. �It is a particularly good language for working with lists of numbers, words, and objects, and it has been widely used in artificial intelligence (AI) work. �In mathematics, a function takes arguments and returns a value. �LISP works the same way, and LISP is called a “functional language” �example: (+ 2 5) 10
Cobol (COmmercial and Business. Oriented Language) �In 1959 a consortium of six computer manufacturers and three US government agencies released Cobol as the computing language for business applications. �Cobol, like FORTRAN, is an imperative, procedural language. �To make the code more self-documenting, Cobol was designed to be a remarkably “wordy” language. �The following line adds two numbers and stores the result in a third variable: ADD Y, Z GIVING X. 11
PL/1 and BASIC �Both PL/1 and BASIC were introduced in 1964. �These, too, are procedural, imperative languages. �IBM designed PL/1 with the plan of “unifying” scientific and commercial programming. �PL/1 was part of the IBM 360 project, and PL/1 was intended to supplant both FORTRAN and Cobol 12
BASIC (Beginner’s All-purpose Symbolic Instruction Code) �BASIC was designed at Dartmouth by professors Kemeny and Kurtz as a simple language for beginners. �Over time, however, an almost countless number of variations of BASIC have been created, and some are very rich in programming power. �Microsoft’s Visual Basic, for example, is a powerful language rich in modern features. 13
C �Dennis Ritchie created the very influential thirdgeneration language C in 1971. �C was developed as a language with which to write the operating system Unix, and the popularity of C and Unix rose together. �C is also an imperative programming language. �An important part of C’s appeal is its ability to perform low-level manipulations, such as manipulations of individual bits, from a high-level language. 14
Smalltalk �During the 1970 s, the language Smalltalk popularized the ideas of object-oriented programming. �Object-oriented languages are another subcategory of imperative languages. �Both procedural and object-oriented languages are imperative languages. �The difference is that object-oriented languages support object-oriented programming practices such as inheritance, encapsulation, and polymorphism. 15
C++ �In the mid-1980 s, Bjarne Stroustrup, at Cambridge University in Britain, invented an object-oriented language called C++. �C++ is a superset of C; any C program is also a C++ program. �C++ provides a full set of object-oriented features, and at one time was called “C with classes. ” 16
Java �The most popular object-oriented language today is Java, which was created by James Gosling and his colleagues at Sun Microsystems. �Java was released by Sun in 1994, and became an immediate hit due to its appropriateness for web applications, its rich language library, and its hardware independence. �Java’s growth in use among programmers has been unprecedented for a new language. �Today Java and C are the languages most frequently chosen for new work. 17
- Slides: 17