Вы находитесь на странице: 1из 25

by

Bernard D. Otero

is a set of rules that provides a way of


telling a computer what operations to
perform.
is a set of rules for communicating an
algorithm
It provides a linguistic framework for
describing computations

A programming language is a notational system


for describing computation in a machine-readable
and human-readable form.

English is a natural language. It has


words, symbols and grammatical rules.
A programming language also has words,
symbols and rules of grammar.
The grammatical rules are called syntax.
Each programming language has a
different set of syntax rules.

Loops are used to repeat a block of code


the syntax for a for loop in C
language is

Programming languages have evolved


over time as better ways have been
developed to design them.
First programming languages were developed in
the 1950s
Since then thousands of languages have been
developed

Different programming languages are


designed for different types of programs.

Highlevelprogram

class
class Triangle
Triangle {{
...
...
float
float surface()
surface()
return
return b*h/2;
b*h/2;
}}

Lowlevelprogram

LOAD
LOAD r1,b
r1,b
LOAD
LOAD r2,h
r2,h
MUL
MUL r1,r2
r1,r2
DIV
DIV r1,#2
r1,#2
RET
RET

ExecutableMachinecode 0001001001000101
0001001001000101
0010010011101100
0010010011101100
10101101001...
10101101001...

First Generation Languages


Second Generation Languages
Third Generation Languages
Fourth Generation Languages
Fifth Generation Languages

The first generation of programming


language, or 1GL, is machine language.
Machine language is a set of instructions
and data that a computer's central
processing unit can execute directly.
Machine language statements are written
in binary code, and each statement
corresponds to one machine action.

The second generation programming


language, or 2GL, is assembly language.
Assembly language is the human-readable
notation for the machine language used to
control specific computer operations.
An assembly language programmer writes
instructions using symbolic instruction
codes that are meaningful abbreviations or
mnemonics.

An assembler is a program that translates assembly


language into machine language.

Assembly language example

When the above code is compiled and executed, it


produces the following result:

Closer to English but included simple


mathematical notation.
Programs written in source code which must be
translated into machine language programs
called object code.
The translation of source code to object code is
accomplished by a machine language system
program called a compiler.

Alternative to compilation is interpretation


which is accomplished by a system program
called an interpreter.
Common third generation languages

FORTRAN
COBOL
C and C++
Visual Basic

/* Hello World program in C Language*/

A high level language (4GL) that requires


fewer instructions to accomplish a task than
a third generation language.
Used with databases

Query languages (SQL,MYSQL,POSTRGRES)


Report generators
Forms designers
Application generators

/* Query to display subjects from the


database in MYSQL */

Declarative languages
telling the "machine"1 what you would like to
happen, and let the computer figure out how to
do it.

Logic: Prolog
Based on mathematical logic
Rule- or Constraint-based

Family Example (descendants) in Prolog

The goal descendant(X,Y) is true if Y is a descendant of X.


descendant(X, Y) :- offspring(X, Y).descendant(X, Z) :- offspring(X, Y),
descendant(Y, Z).offspring(abraham, ishmael).offspring(abraham, isaac).
offspring(isaac, esau).offspring(isaac, jacob).
If for example the query
| ?- descendant(abraham, X).
is executed, Prolog's backtracking results in different descendants of
Abraham being returned as successive instances of the variable X,
i.e.
X = Ishmael
X = Isaac
X = esau
X = jacob

Scripting Languages
JavaScript and VBScript
Php and ASP
Perl and Python

Command Languages
sh, csh, bash

Text processing Languages


LaTex, PostScript

HTML
HyperText Markup Language.
Used on the Internet and the World Wide Web
(WWW).
Web page developer puts brief codes called tags
in the page to indicate how the page should be
formatted.

XML
Extensible Markup Language.
A language for defining other languages.

Вам также может понравиться