Different Types of Programming Language

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

TITLE: Different types of Computer Languages (Assembly, FORTAN, Pascal, C, C++, Artificial Language)

Computer Languages/ Programming Language:

1. Language that is acceptable to computer.


2. Computer Language must also be used in properly (syntax rule)
3. Must strict to the exact syntax rules.

Classification of Computer Language

1. Machine Language
2. Assembly Language
3. High-level Language

Machine Language:

1. Only language understood/directly execute by the computer without using a translation program.
2. Written as strings of binary 0 and 1.
3. Circuitry of computer is wired in a manner that it immediately recognizes the machine language instruction, and
converts them into the electrical signals needed to execute them.
4.

OPCODE OPERAND
(Operation code) (Address/ Location)

OPCODE: Tells computer what function to perform


OPERAND: what to find/ store the data or other instructions, which are to be manipulated.
5. Advantage and Limitations of Machine Language
 Machine Dependent: Internal design and machine language differ from computer to computer. Change
to computer need programmer to learn machine language for that particular computer.
 Difficult to program: Have to memorize a lot of operations code number, keep track of the storage
locations of data and instruction. Must be expert in hardware structure of the computer.
 Error prone: Programmer has to remember the opcodes and keep track of the storage locations so it’s
very difficult to concentrate fully on logic of the problem. This results in programming errors.
 Difficult to modify: Difficult and time consuming

Assembly Language

1. Introduced in 1952
2. Use alphanumeric mnemonic code, instead of numeric.
Example: using ADD instead of 1110, SUB instead of 1111
3. Allow storage locations to be represented in the form of alphanumeric address.
Example: FRST, SCND and ANSR instead of 1000, 1001 and 1010.
4. Provides pseudo-instructions, which are used for instructing the system how we want the program to be
assembled inside the computer’s memory.
Example:

START PROGRAM AT 0000


START DATA AT 1000
SET ASIDE AN ADDRESS FOR FRST
 First instruction tells assembler that the instruction for the main program should start at memory location 0000.
 Data of the program should start at memory location 1000.
 Set aside address for data items FRST.

5. Advantages and Limitations of Assembly language


 Easier to understand and use
 Easier to locate and correct errors
 Easier to modify
 No worry about address
 Machine dependent
 Knowledge of hardware required
 Machine level coding

High Level Language

1. Machine Independent.
2. Can be easily ported and executed on any computer, which has the translator software for the high-level
language.
3. Programmers need not know anything about the internal structure of the computer
4. Allows programmers to mainly concentrate on logic of the problem
5. Enable programmers to write instructions using English words and familiar mathematical symbols and
expressions.

Advantages and Limitations

 Machine independent
 Easier to learn and use: Similar to natural language.
 Fewer errors: Programmer concentrate more on logic. Furthermore, compilers and interpreters are
designed to automatically check syntax error.
 Lower program preparation cost
 Better documentation: very similar to natural language. Can easily be understood by a programmer
familiar with the problem domain.
 Easier to maintain.
 Lower Efficiency: take more time to execute, require more memory space.
 Less Flexibility: normally do not have instructions or mechanism to control the computer’s CPU,
memory and registers.

Programming Language Tools:

Compiler:

 Translator Program (software) that translate high-level language program into its equivalent machine language
program.
  Translate source code from a high-level programming language to a lower level language.
 Each high level language instruction can be translated into a set of machine language instructions, rather
than a single machine language instruction (one-to-many correspondence).
 FORTRAN compiler is only capable of translating source programs, written in FORTRAN.
f

Figure:

 In addition to doing translation job compilers also automatically detect and indicate syntax errors.
 Compiler cannot detect logical errors.

Interpreter

 Another type of high-level language translator.


 Takes one statement of a high-level language program, translate it into machine language instructions.
 Immediately executes the resulting machine language instructions.
 It reads only one statement of program, translates it and executes it. Then it reads the next statement of the
program again translates it and executes it. In this way it proceeds further till all the statements are translated
and executed. On the other hand, a compiler goes through the entire program and then translates the entire
program into machine codes.
 By the compiler, the machine codes are saved permanently for future reference. On the other hand, the
machine codes produced by interpreter are not saved. An interpreter is a small program as compared to
compiler. It occupies less memory space, so it can be used in a smaller system which has limited memory space.
Programming Paradigms:

Programming Paradigms represent the style of programming. There are many programming paradigms, the difference
between them is basically in concepts and representation of elements. A few points related to programming paradigms
are given below:

 A paradigm is defined as: “An example that serves as pattern or model”


 Represents style of programming.
 Paradigms may differ in concepts and representation of elements
 Few Paradigms:
o Non-structured
o Structured
o Object oriented

Non-Structure Programming:

 Code is written in a single continuous program.


 Allows control to jump to any line using ‘goto’ statement.
 Limitations
o Difficult to maintain code as size of program increases
o Code cannot be reused
o Difficult to test code

Structured Programming:

 Program is divided into smaller subtasks/modules.


 Complexity made manageable
 Maintenance made easier.
 Control flow between modules can be defined in a structured manner.
 Good model for small-medium size projects.
 Example: C, PASCAL
 Limitations:
o Emphasis is more on functionality, less on data.
o Data and functionality are treated separately.
o Does not represent the real world.
o Data may not be secure.

Object Oriented Programming

 Represent real world objects.


 Objects have properties.
 Objects exhibit behavior and interacts with other objects.
 Useful for development of enterprise applications.
 Has features for data security, code reuse and maintainability.
 Examples: C++ and Java.

Artificial Language: What? Explain Briefly.

You might also like