You are on page 1of 16

COMPUTER LANGUAGES All computer languages can be classified in the following three broad categories: Machine Language Assembly

ly Language High-level Language

Machine Language
The language that is understood by the computer without using any translation program is called machine language or the machine code of the computer. Machine code is the fundamental language of a computer and is written as strings of binary 1s and 0s. An instruction prepared in any machine language has a two-part format. The first part is the command or operation, i.e., the operation to be performed. Every computer has an operation code or opcode for each of its functions. The second part of the instruction is the operand, and it tells the computer where to find or store the data or other OPCODE ( OPERATION CODE) OPERAND (ADDRESS / LOCATION)

instructions that are to be manipulated. Thus, each instruction tells the control unit of the CPU what to do and the length and location of the data fields that are involved in the operation.

Advantages and Limitations of Machine Language

Programs written in machine language can be executed very fast by the computer. This is due to the reason that the CPU directly understands machine instructions and no translation of the program is required. However, writing a program in machine language has several disadvantages: i)Machine dependent. Because the internal design of every type of computer is different from every other type of computer and needs different electrical signals to operate, the machine language also is different from computer to computer. ii)Difficult to program. It is very difficult to program using machine language. It becomes necessary for the programmer to memorize the dozens of code numbers for the commands in the machines instruction set. iii)Error prone. For writing programs in machine language, a programmer not only has to remember the opcodes but also the storage location of data and instructions. This frequently results in program errors. iv)Difficult to modify. It is difficult to correct or modify machine language programs because checking instructions to locate errors is a difficult task.

Assembly Language
The language which substitutes letters and symbols for the numbers in the machine language program is called an assembly language or symbolic language. A program written in symbolic language that uses symbols instead of numbers is called an assembly code or a symbolic program. The translator program that translates an assembly code into the computers machine code is called an assembler.
Assembly language program INPUT ASSEMBLER OUTPUT Machine language program


OpCode 00 10 14 15 30

Meaning Halt, used at end of program to stop Clear & Add into A register Add to the contents of A register Subtract from contents of A register Store A register

Advantages of Assembly Language 1.Easier to understand and use. 2.Easy to locate and correct errors. 3.Easier to modify 4.Easily relocatable 5.Efficiency of machine language Limitations of Assembly Language 1.Machine dependent 2.Knowledge of hardware required 3.Machine level coding

High-Level Language
High level languages were developed in order to facilitate the programmers to use computers without the need to know in detail the internal structure of the computer. These languages enable the programmer to write instructions using English words and familiar mathematical symbols. High level language is subdivided into three generations: Procedural-oriented or third generation Problem-oriented or fourth generation Natural or fifth generation

1)PROCEDURAL-ORIENTED/ 3 GL LANGUAGES General purpose programming languages are called procedural languages. They are languages such as BASIC, COBOL, FORTRAN, C, C++, Java which are designed to express the logic, the procedure, of a problem. Because of their flexibility, procedural languages are able to solve a variety of problems. ADVANTAGES:a) Easier to work with as resemble to English b) Less time is required to program a problem. c) Once coded, programs are easier to understand and to modify. d) Machine- independent. DISADVANTAGES:a) programs execute more slowly b) the languages use computer resources less efficiently.

2) PROBLEM ORIENTED / 4 GL LANGUAGES are designed to solve specific problems or develop specific applications by enabling you to describe what you want rather than step-by-step procedures. They may categorized into various kinds of application development tools: Personal Computer applications software Query languages and report generators Decision support systems and financial planning languages Application generators All 4GLs are designed to reduce: programming effort. the time it takes to develop software. the cost of software development. Examples are D Base, SQL, Oracle, Foxpro

3) NATURAL / 5 GL LANGUAGES Fifth generation languages are designed to make the computer solve the problem for you. This way the programmer only needs to worry about what problems needs to be solved and what conditions need to be met without worrying about how to implement a routine or algorithm to solve them. Fifth-generation languages are used mainly in Artificial intelligence research. Prolog, LISP, and Mercury are the best known fifth-generation languages. FEATURES ARE: They are designed to make the connections that humans have with computers more natural-more humanlike. They are designed to allow the computer to become smarter- to actually simulate the learning process by remembering and improving upon earlier information.

LANGUAGE TRANSLATORS:ASSEMBLERS The assembler accepts an assembly language program (the source code) as its data input, processes it and produces as output the required machine code program (the object code). Different types of Assembler Resident Assembler: This is an assembler that runs only on the target computer. It will only translate the mnemonics into the specific machine code for the processor resident in the particular computer. Cross assembler: Unlike the resident assembler the cross assembler is able to produce the object code that will run on a different machine. Two-pass assembler: When source code is to be assembled this type of assembler will first go through the source code producing the object code, but will ignore forward references such as jumps This is called the first pass. On the second pass the assembler will go through and resolve all the jump addresses to produce the final object code. Meta assembler: This is an assembler that can deal with many different instruction sets.

A compiler is a translating program that translates the instructions of a high level language into machine language. A program written by a programmer in a high level language is called a source program. After this source program has been converted into machine language by a compiler, it is referred to as an object program.
High-level language program


Machine language program

While translating a given program, the compiler analysis each statement in the source program and uncovers certain types of errors, known as diagnostic errors. The compiler can diagnose the following kinds of errors: a)Illegal characters b)Illegal combination of characters c)Improper sequencing of instructions in program

Advantages of a compiler (1) A compiled program will almost always run faster than an interpreted one, as no translation is taking place at the same time. (2) The object program(the machine code generated by the compiler) may be saved on disk and run whenever required without being re-compiled or requiring the user to have the compiler (3) Commercially produced software can be sold in the form of object code, thus preventing purchasers from listing the source code and making modifications to it.

An interpreter is another type of translator used for translating high level languages into machine code. It takes one statement of a high-level language and translates it into a machine instruction, which is immediately executed. Advantages of HLL a) Machine independence (b) Easy to learn and use (c) Fewer errors (d) Lower program preparation cost (e) Better documentation (f) Easier to maintain Limitations of HLL (a) Lower efficiency: a program written in assembly language or machine language is more efficient than one written in high-level language. (b) Lack of flexibility: Because the automatic features of high-level languages always occur, they are less flexible than assembly languages.


INTERPRETER COMPILER 1)It is a type of translator used 1) it is also a translating program for translating source code to that translate the instruction of a Object code HLL into ML. 2) Interpreters takes one state 2) compilers compiles whole set of instructions at once -ment of HLL and translates The same into ML which is Immediately executed. 3) Performs translations and 3) It merely translates the entire execution for every instruction source program and is not Alternately for each statement involved in its execution In the HLL program.

4) It is suitable for progra- 4) It is suitable for progra ms of small size. ms of large size. 5) It does not save the 5) it translates the whole object code for future use source program into its as the translation and object code and is stored execution are done permanently for future alternately use. 6) Execution time is more 6) Execution time is less.


In computer science, a linker or link editor is a program that takes one or more objects generated by compilers and assembles them into a single executable program. Many programming languages allow you to write different pieces of code, called modules. Linkers job is to put all the modules together. In addition to combining modules, a linker also replaces symbolic addresses with real addresses. Therefore, you may need to link a program even if it contains only one module. A loader is a program that performs the functions of a linker program and then immediately schedules the resulting executable program for action (in the form of a memory image), without necessarily saving the program as an executable file.Loader programs are useful for prototyping, testing, etc.