Computer Languages
Bali Thorat
Types of Programming Languages
• Machine Languages
• Assembly Languages
• High Level Languages
Bali Thorat
Machine Languages
• A machine language consists of the numeric codes for the operations that a
particular computer can execute directly.
• The codes are strings of 0s and 1s, or binary digits (“bits”), which are
frequently converted both from and to hexadecimal (base 16) for human
viewing and modification.
• Machine language instructions typically use some bits to represent
operations, such as addition, and some to represent operands, or perhaps
the location of the next instruction.
• Machine language is difficult to read and write, since it does not resemble
conventional mathematical notation or human language, and its codes vary
from computer to computer.
Bali Thorat
Assembly language
• Assembly language is one level above machine language.
• It uses short mnemonic codes for instructions and allows the programmer to introduce
names for blocks of memory that hold data.
• One might thus write “add pay, total” instead of “0110101100101000” for an instruction
that adds two numbers.
• Assembly language is designed to be easily translated into machine language.
• Although blocks of data may be referred to by name instead of by their machine
addresses, assembly language does not provide more sophisticated means of organizing
complex information.
• Like machine language, assembly language requires detailed knowledge of
internal computer architecture.
• It is useful when such details are important, as in programming a computer to interact
with peripheral devices (printers, scanners, storage devices, and so forth).
Bali Thorat
High Level Languages
• A high-level language (HLL) is a programming language such as C,
FORTRAN, or Pascal that enables a programmer to write programs
that are more or less independent of a particular type of computer.
• Such languages are considered high-level because they are closer to
human languages and further from machine languages.
Bali Thorat
Assembler
• An assembler translates assembly language programs into machine
code.
• The output of an assembler is called an object file, which contains a
combination of machine instructions as well as the data required to
place these instructions in memory.
Bali Thorat
Linker
• Linker is a computer program that links and merges various object
files together in order to make an executable file.
• All these files might have been compiled by separate assemblers.
• The major task of a linker is to search and locate referenced
module/routines in a program and to determine the memory location
where these codes will be loaded, making the program instruction to
have absolute references.
Bali Thorat
Loader
• Loader is a part of operating system and is responsible for loading
executable files into memory and execute them.
• It calculates the size of a program (instructions and data) and creates
memory space for it.
• It initializes various registers to initiate execution.
Bali Thorat
Interpreter
• An interpreter translates high-level language into low-level machine
language.
• An interpreter reads a statement from the input, converts it to an
intermediate code, executes it, then takes the next statement in
sequence.
• If an error occurs, an interpreter stops execution and reports it.
Bali Thorat
Compiler
• Compiler, translates high-level language into low-level machine
language.
• A compiler reads the whole source code at once, creates tokens,
checks semantics, generates intermediate code, executes the whole
program and may involve many passes.
• Compiler reads the whole program even if it encounters several
errors.
Bali Thorat
• User writes a program in C language (high-level language).
• The C compiler, compiles the program and translates it to assembly
program (low-level language).
• An assembler then translates the assembly program into machine code
(object).
• A linker tool is used to link all the parts of the program together for
execution (executable machine code).
• A loader loads all of them into memory and then the program is executed.
Bali Thorat

4 computer languages

  • 1.
  • 2.
    Types of ProgrammingLanguages • Machine Languages • Assembly Languages • High Level Languages Bali Thorat
  • 3.
    Machine Languages • Amachine language consists of the numeric codes for the operations that a particular computer can execute directly. • The codes are strings of 0s and 1s, or binary digits (“bits”), which are frequently converted both from and to hexadecimal (base 16) for human viewing and modification. • Machine language instructions typically use some bits to represent operations, such as addition, and some to represent operands, or perhaps the location of the next instruction. • Machine language is difficult to read and write, since it does not resemble conventional mathematical notation or human language, and its codes vary from computer to computer. Bali Thorat
  • 4.
    Assembly language • Assemblylanguage is one level above machine language. • It uses short mnemonic codes for instructions and allows the programmer to introduce names for blocks of memory that hold data. • One might thus write “add pay, total” instead of “0110101100101000” for an instruction that adds two numbers. • Assembly language is designed to be easily translated into machine language. • Although blocks of data may be referred to by name instead of by their machine addresses, assembly language does not provide more sophisticated means of organizing complex information. • Like machine language, assembly language requires detailed knowledge of internal computer architecture. • It is useful when such details are important, as in programming a computer to interact with peripheral devices (printers, scanners, storage devices, and so forth). Bali Thorat
  • 5.
    High Level Languages •A high-level language (HLL) is a programming language such as C, FORTRAN, or Pascal that enables a programmer to write programs that are more or less independent of a particular type of computer. • Such languages are considered high-level because they are closer to human languages and further from machine languages. Bali Thorat
  • 6.
    Assembler • An assemblertranslates assembly language programs into machine code. • The output of an assembler is called an object file, which contains a combination of machine instructions as well as the data required to place these instructions in memory. Bali Thorat
  • 7.
    Linker • Linker isa computer program that links and merges various object files together in order to make an executable file. • All these files might have been compiled by separate assemblers. • The major task of a linker is to search and locate referenced module/routines in a program and to determine the memory location where these codes will be loaded, making the program instruction to have absolute references. Bali Thorat
  • 8.
    Loader • Loader isa part of operating system and is responsible for loading executable files into memory and execute them. • It calculates the size of a program (instructions and data) and creates memory space for it. • It initializes various registers to initiate execution. Bali Thorat
  • 9.
    Interpreter • An interpretertranslates high-level language into low-level machine language. • An interpreter reads a statement from the input, converts it to an intermediate code, executes it, then takes the next statement in sequence. • If an error occurs, an interpreter stops execution and reports it. Bali Thorat
  • 10.
    Compiler • Compiler, translateshigh-level language into low-level machine language. • A compiler reads the whole source code at once, creates tokens, checks semantics, generates intermediate code, executes the whole program and may involve many passes. • Compiler reads the whole program even if it encounters several errors. Bali Thorat
  • 11.
    • User writesa program in C language (high-level language). • The C compiler, compiles the program and translates it to assembly program (low-level language). • An assembler then translates the assembly program into machine code (object). • A linker tool is used to link all the parts of the program together for execution (executable machine code). • A loader loads all of them into memory and then the program is executed. Bali Thorat