COMPUTER LANGUAGES Answer these questions. a. How many languages can you speak? b. Do you know how many languages a computer can speak? c. How many generations are there in your family? to add: aggiungere nowadays: oggigiorno source code: codice sorgente syntax: sintassi time-consuming: lungo Lisp was the first example of interpreter. It was first defined in 1958 by Steve Russell. 7 LOW LEVEL LANGUAGES, HIGH LEVEL LANGUAGES AND TRANSLATION PROGRAMS Computers are devices which follow instructions, but unfortunately they only understand machine language or machine code. Machine language is made up of a sequence of 0s and 1s that the computer s controls interpret electrically as instructions. Programmers plan the set of instructions to give a computer using an algorithm, and they then have to write them in a language that the computer can understand. However, it is almost impossible for humans to program using such a language since it is very difficult to remember long sequences of binary code. Moreover, such programs take a long time to create and read and are not portable because they are machine specific, i.e. created for a given type of CPU. For these reasons, other programming languages than machine code were invented. Programming languages can be classified into low level and high level languages. Low level languages (LLL) are considered closer to computers and their primary function is to operate, manage and manipulate the computer hardware and components. Programs and applications written in a lowlevel language are directly executable on the computer hardware without any interpretation or translation. Machine language and assembly language are examples of low level languages. High level languages (HLL) were created with the programmer in mind and their syntax is closer to a natural language like English. For example, they have words and a sentence-like structure. For this reason, they are easier to learn and use. Moreover, they are not machine-dependent and a program, once written, can be used on different types of computers. However, in order to be executed, programs written in a high level language need to be translated. There are three types of translation programs: compilers and interpreters are used for high level languages, and assemblers for assembly language. A compiler converts the whole program in one go, i.e. all at once. It converts it into an object file, and a related program, called linker, converts the object file into an executable file. An interpreter takes each line of instruction in turn from the source code, converts it to machine code and executes it one by one. An assembler translates assembly language into machine code. One instruction in assembly corresponds to one machine code instruction. Nowadays, most commercial programs are sold compiled, so that they will run faster and it will be difficult for others to change the program since it is now in machine code, thus protecting the manufacturer s intellectual property, which can be copyrighted by law. 102 Module 3 FLOWCHARTING