Week 8 & 9 - Computer Languages

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 43

Introduction to CF

(MET)

WEEK 08 & 09
Computer Languages
Hardware/Software Interaction

Code
 Statements written in a programming language
 Writing code can be tedious
 Code must be perfect
 Order of steps must be exact
 Writing code is quite exciting
 Problems are solved
 New ideas are formed
Writing Code
Hardware/Software Interaction

Machine code
 Recall that computers think in binary
 Code is translated into machine code
 CPU executes the machine code
 CPUs have a unique machine code
Hardware/Software Interaction

Programming languages
 Simplifies the writing of code
 Original code is called source code
 Several hundred languages exist
Types of Languages

Machine language
Assembly language
High-level language
Machine Language

Only language of a computer understood by it without


using a translation program
Normally written as strings of binary 1s and 0s
Written using decimal digits if the circuitry of the
computer being used permits this
OPCODE tells the computer which operation to perform
from the instruction set of the computer
OPERAND tells the address of the data on which the
operation is to be performed
001000000000001100111001 10001471
001100000000010000100001 14002041
011000000000011100101110 30003456
101000111111011100101110 50773456
000000000000000000000000 00000000

In Binary In Decimal
(Difficult to read and understand) (Easier to read and understand)
Advantages & Limitations of Machine Language

Advantages
 Can be executed very fast

 Limitations
 Machine Dependent
 Difficult to program
 Error prone
 Difficult to modify
Assembly Language

Programming language that overcomes the limitations of


machine language programming by:
Using alphanumeric mnemonic codes instead of numeric
codes for the instructions in the instruction set e.g. using
ADD instead of 1110 (binary) or 14 (decimal) for instruction
to add
Allowing storage locations to be represented in form of
alphanumeric addresses instead of numeric addresses
Providing pseudo-instructions that are used for instructing the
system how we want the program to be assembled inside the
computer’s memory e.g. START PROGRAM AT 0000; SET
ASIDE AN ADRESS FOR FRST
Assembler

Software that translates as assembly language program


into an equivalent machine language program of a
computer
Advantages of Assembly Language over Machine Language

Easier to understand and use


Easier to locate and correct errors
Easier to modify
No worry about addresses
Efficiency of machine language
Limitations of Assembly Language

Machine dependent
Knowledge of hardware required
Machine level coding
High-level Languages

Machine independent
Do not require programmers to know anything about the
internal structure of computer on which high-level
language programs will be executed
Deal with high-level coding, enabling the programmers to
write instructions using English words and familiar
mathematical symbols and expressions
Compiler

Translator program (software) that translates a high-level


language program into its equivalent machine language
program
Compiles a set of machine language instructions for every
program instruction in a high-level language
Syntax Errors

In addition to doing translation job, compilers also


automatically detect and indicate syntax errors
Syntax errors are typically of following types:
 Illegal characters
 Illegal combination of characters
 Improper sequencing of instructions in a program
 Use of undefined variable names
 Note : A compiler cannot detect logic errors in a program
Linker

For a large software, storing all the lines of program code in a


single source file will be:
 Difficult to work with
 Difficult to deploy multiple programmers to concurrently work towards
its development
 Any change in the source program would require the entire source
program to be recompiled
Hence, a modular approach is generally adapted to develop
large software where the software consists of multiple source
program files
No need to write programs for some modules as it might be
available in library offering the same functionality
Linker

Each source program file can be independently modified


and compiled to create a corresponding object program
file
Linker program (software) is used to properly combine all
the object program files (modules)
Creates the final executable program (load module)
Interpreter

Interpreter is a high-level language translator


Takes one statement of a high-level language program,
translates it into machine language instructions
Immediately executes the resulting machine language
instructions
Compiler simply translates the entire source program into
an object program and is not involved in its execution
Role of an Interpreter
Advantages of High-Level Languages

Machine independent
Easier to learn and use
Fewer errors during program development
Lower program preparation cost
Better documentation
Easier to maintain
Limitation of High-Level Language

Lower execution efficiency


Less flexibility to control the computer’s CPU, memory
and registers
Fortran

Stands for FORmula TRANslation


Originally developed by John Backus and his team
Designed for solving scientific & engineering problems
Oriented towards solving problems of a mathematical
nature
Popular language amongst scientists and engineers
Cobol

Stands for COmmon Business Oriented Language


Originally developed started under Grace Hopper
followed by COnference on DAta SYstems Languages
(CODASYL)
Designed for programming business data processing
applications
Designed to have the appearance and structure of a
business report written in English, hence often referred to
as a self-documenting language
Basic

Stands for Beginners All-purpose Symbolic Instruction


Code
Developed by Professor John Kemeny and Thomas Kurtz
at Darmouth College in the United States
Designed to be an interactive language and to use an
interpreter instead of a compiler
Simple to implement, learn and use language. Hence, it is
a widely used language on personal computers
Flexible and reasonably powerful language and can be
used for both business and scientific applications
Pascal

Named after the famous seventeenth-century French


mathematician Blaise Pascal
Developed by Professor Nicklaus Wirth of Federal
Institute of Technology in Zurich
Encourages programmers to write well-structured,
modular programs, instills good program practices
Recognized as an educational language and is used to
teach programming to beginners
Suitable for both scientific & business applications
Has features to manipulate numbers, vectors, matrices,
strings, sets, records, files, and lists
C

Developed in 1972 at AT&T’s Bell laboratories, USA


by Dennis Ritchie and Brian Kernighan
High-level programming languages (mainly machine
independence) with the efficiency of an assembly
language
Language of choice of programmers for portable
systems software and commercial software packages
like OS, compiler, spreadsheet, word processor, and
database management systems
C++

Named C++ as ++ is increment operator and C


language is incremented to its next level with C++
Developed by Bjarne Stroustrup at Bell Labs in the
early 1980s
Contains all elements of the basic C language
Expanded to include numerous object-oriented
programming features
Provides a collection of predefined classes, along with
the capability of user-defined classes
Java

Development started at Sun Microsystems in 1991 by a


team led by James Gosling
Developed to be similar to C++ with fewer features to
keep it simple and easy to use
Compiled code is machine-independent and developed
programs are simple to implement
Used in embedded systems such as hand-held devices,
telephones and VCRs
Comes in two variants – Java Runtime Engine (JRE)
and Java Software Development Kit (SDK)
C# ( C sharp)

Object-oriented programming language developed by


Anders Hejlsberg and released by Microsoft as part of
Microsoft’s .NET technology initiative
Syntactically and semantically very close to C++ and
adopts various object-oriented features from both C++
and Java
LISP

Stands for LISt Processing


Developed in 1959 by John McCarthy of MIT
Designed to have features for manipulating non-
numeric data, such as symbols and strings of text
Due to its powerful list processing capability, it is
extensively used in the areas of pattern recognition,
artificial intelligence, and for simulation of games
Functional programming language in which all
computation is accomplished by applying functions to
arguments
WWW Development Languages
13B-
37

Markup languages
 Describe how the text is formatted
Hyper Text Markup Language (HTML)
 Basis of all web pages
 Defines web structure using tags
 Easy to learn and use
 Created with a text editor
WWW Development Languages
13B-
38

Extensible Markup Language (XML)


 Stores data in a readable format
 Looks like HTML
 Allows developers to create tags
 Depends on HTML for formatting
XML
13B-
39
WWW Development Languages
13B-
40

Scripting languages
 Create dynamic web pages
 Change based on user input
 HTML can create static pages
 Page is generated as needed
WWW Development Languages
13B-
41

JavaScript
 Developed by Netscape
 Works inside of HTML
 Page verification and simple animation
 Based on Java
WWW Development Languages
13B-
42

Perl
 Old UNIX language
 Found on all Windows and Linux servers
 Excellent web scripting language
WWW Development Languages
13B-
43

Hypertext Pre-Processor (PHP)


 Especially good at connecting to MySQL
 Very popular language
 Runs on UNIX and Windows

You might also like