PROGRAMMING By: Ronalie D.
Avila
LANGUAGE BTTE – E4K A
Programming Languages
Now that we can define and flowchart
the desired process, we need to be able
to communicate this process to the
computer. We need language which the
computer understands. Many languages
have been developed for use with
computers.
Programming Languages
Computer Program
A program is a set of instructions following the rules
of the chosen language.
Without programs, computers are useless.
A program is like a recipe.
It contains a list of ingredients (called variables)
and a list of directions (called statements) that tell
the computer what to do with the variables.
Programming Languages
A vocabulary and set of grammatical rules (syntax)
for instructing a computer to perform specific tasks.
Programming languages can be used to create
computer programs.
The term programming language usually refers to
high-level languages, such as BASIC, C, C++,
COBOL, FORTRAN, Ada, and Pascal.
Programming Languages
You eventually need to convert your
program into machine language so that the
computer can understand it.
There are two ways to do this:
– Compile the program
– Interpret the program
Programming Languages
Compile
is to transform a program written in a high-level
programming language from source code into
object code.
This can be done by using a tool called compiler.
A compiler reads the whole source code and
translates it into a complete machine code
program to perform the required tasks which is
output as a new file.
Programming Languages
Interpreter
is a program that executes instructions
written in a high-level language.
An interpreter reads the source code one
instruction or line at a time, converts this line
into machine code and executes it.
Programming Languages
Computer programming is the process of
writing, testing, debugging/troubleshooting,
and maintaining the source code of
computer programs.
This source code is written in a programming
language like C++, JAVA, Perl etc.
Types of Programming Language
There are three types of programming
language:
Machine language (Low-level language)
Assembly language (Low-level language)
High-level language
Low-level languages are closer to the language
used by a computer, while high-level languages
are closer to human languages.
Machine Language
There is only one language the computer
actually understands, and that is machine
language, which consist of 1’s and 0’s.This
binary language is fine for the computer
but not for people.
Machine Language
To have to communicate with the
computer in binary, you would place in its
memory a series of numbers that might look
like this:
10010100
01001010
00101001
Machine Language
It would be nearly impossible to
remember what the many different
patterns of 1s and 0s meant, and the
probability of making mistake would be
very high. Something better is needed.
Machine Language
Example:
Let us say that an electric toothbrush has a
processor and main memory.
The processor can rotate the bristles left and
right, and can check the on/off switch.
The machine instructions are one byte long,
and correspond to the following machine
operations:
Machine Language
Machine Instruction Machine Operation
0000 0000 Stop
0000 0001 Rotate bristles left
0000 0010 Rotate bristles right
0000 0100 Go back to start of program
0000 1000 Skip next instruction if switch is off
Assembly Language
The first step toward a
language that is easier for
people to work with uses
abbreviations to stand for
different operations.
Assembly Language
This “language” of abbreviations is
called assembly language. The
“abbreviations” are called mnemonics.
A mnemonic (pronounced ne-’män-ik) is
something that aids the memory.
Mnemonics are designed to be easy to
remember and are a significant
improvement over binary digits.
Assembly Language
The problem is that the computer doesn't
understand the assembly code, so we need
a way to convert it to machine code, which
the computer does understand.
Assembly language programs are
translated into machine language by a
program called an assembler.
Assembly Language
Example:
Machine language : 10110000 01100001
Assembly language : mov a1, #061h
Meaning: Move the hexadecimal value
61 (97 decimal) into the processor register
named "a1".
High-Level Languages
Over the course of time, people working
with computers felt it would be helpful to
create languages that were more like
English, so that it would not be so difficult
to communicate with the computer and
so that more advanced commands could
be created. We call this high-level
language.
High-Level Languages
For example, many microprocessors do
not have the ability to multiply or divide. It
is obvious, however, that these are
common mathematical functions that
must be available to a computer
programmer.
High-Level Languages
In machine or assembly language
one can use repeated additions to
multiply or repeated subtractions to
divide. This is not necessarily the best
way to multiply or divide, but it is one
way.
High-Level Languages
In a high-level language there are
“multiply” and “divide” commands. The
language knows how to create the
multiply and divide functions even through
the microprocessor does not have these
functions built in.
High-Level Languages
In fact, these languages can understand
English commands like print, run, do, next,
and end. The microprocessor does not
understand these English word, but the
language changes (interprets or compiles)
them into machine language before
sending them to the microprocessor.
High-Level Languages
EXAMPLE
FORTRAN (Formula Translation) – is a
language that handles high-level
mathematics very well and is designed for
scientist and engineers.
High-Level Languages
COBOL – which stands for Common
Business-Oriented Language, is tailored to
the needs of business.
BASIC, which stands for Beginner’s All-
purpose Symbolic Instruction Code, was
designed to be easy for nonprofessional
programmers to learn and use.
High-Level Languages
PASCAL, named for the French
mathematician Blaise Pascal, is designed
to encourage the programmers to adhere
to what are considered “correct”
programming practices.
In-between Language
There are some languages that are
somewhat “in between” the high-level and
low-level languages, most notably C and
FORTH.
In-between Language
C is much closer to assembly language
than are most other high-level languages.
The first major program written in C was
the UNIX operating system.
The low-level nature of C, however, can
make the language difficult to use for
some types of applications.
Developed by Dennis Ritchie at Bell Labs
in the mid 1970s.
In-between Language
C
Example:
#include <stdio.h>
int main(void)
{
printf("hello, world\n"); return 0;
}
In-between Language
Forth is a high-level programming
language, although most versions
include an assembler. Forth-system
providers often include software tools to
help application code make good use
of system resources.
Programming Languages
High-level Languages
1. FORTRAN
2. COBOL
3. BASIC
4. PASCAL
Programming Languages
In-between Languages
1. C
2. FORTH
Programming Languages
Low-level Languages
1. Assembly
2. Machine
Generations of Programming Language
The first generation languages, or 1GL,
are low-level languages that are
machine language.
The second generation languages, or
2GL, are also low-level languages that
generally consist of assembly
languages.
Generations of Programming Language
The third generation languages, or 3GL, are
high-level languages such as C.
The fourth generation languages, or 4GL,
are languages that consist of statements
similar to statements in a human language.
Fourth generation languages are commonly
used in database programming and scripts.
Generations of Programming Language
The fifth generation languages, or 5GL,
are programming languages that
contain visual tools to help develop a
program. A good example of a fifth
generation language is Visual Basic.
Choosing a Programming Language
Before you decide on what language to use,
you should consider the following:
your server platform
the server software you run
your budget
previous experience in programming
the database you have chosen for your
backend
END.
THANK YOU FOR
LISTENING!!!
Get ready for a Quiz!