Sei sulla pagina 1di 20

Computer and Information Technology for (HKCEE) Core Module

13.1Roles of Programming Language


13.2Historical Development of Programming Langu
13.3Low-level and High-level Programming Langua
13.4Assembler, Compiler and Interpreter
Computer and Information
Technology for (HKCEE)
Core module: Part D

13.1 Roles of Programming Language


Programming language
artificial language based on a set of grammar rules
convert a solution algorithm into a computer
program
flowchart / programming
pseudocode language

Problem solution computer


algorithm program

© Longman Hong Kong Education Page2


Computer and Information
Technology for (HKCEE)
Core module: Part D

13.2 Historical Development of


Programming Languages
Generation
classification of programming language
development
First-generation language (1GL)
machine language

x 86 machine language
1100 1001 0010 1001 1101 0011

© Longman Hong Kong Education Page3


Computer and Information
Technology for (HKCEE)
Core module: Part D

13.2 Historical Development of


Programming Languages
Second-generation language (2GL)
assembly language

x 86 assembly language
mov CX, 1234 H

© Longman Hong Kong Education Page4


Computer and Information
Technology for (HKCEE)
Core module: Part D

13.2 Historical Development of


Programming Languages
Third-generation language (3GL)
procedural language
e.g. Pascal, Java, C
{Pascal program}
BEGIN
writeln (PowerOf2);
PowerOf2 := PowerOf2 * 2;
Count := Count + 1;
END;
writeln (‘There are’, Count : 4, ‘powers of 2 less than 100.’);

© Longman Hong Kong Education Page5


Computer and Information
Technology for (HKCEE)
Core module: Part D

13.2 Historical Development of


Programming Languages
Fourth-generation language (4GL)
declarative language
e.g. SQL

SELECT * FROM RECORD WHERE NAME = “CHAN”

© Longman Hong Kong Education Page6


Computer and Information
Technology for (HKCEE)
Core module: Part D

13.3 Low-level and High-level


Programming Languages
Low-level programming languages
Machine language
Assembly language

© Longman Hong Kong Education Page7


Computer and Information
Technology for (HKCEE)
Core module: Part D

13.3.1 Low-level programming


languages
Machine language
ready for immediate execution by computers
stored as bytes in memory
operation code: unique numeric code of each
instruction

© Longman Hong Kong Education Page8


Computer and Information
Technology for (HKCEE)
Core module: Part D

13.3.1 Low-level programming


languages
Shortcomings of Machine languages
difficult to program in
lengthy
machine-dependent
not portable
difficult to learn

© Longman Hong Kong Education Page9


Computer and Information
Technology for (HKCEE)
Core module: Part D

13.3.1 Low-level programming


languages
Assembly language
easier to understand than machine language
stored as text
examples
add EAX, EBX
mnemonic for addition instruction
add
General form of assembly instruction
mnemonic operand(s)
© Longman Hong Kong Education Page10
Computer and Information
Technology for (HKCEE)
Core module: Part D

13.3.1 Low-level programming


languages
Assembler
convert assembly language program into machine
code
Shortcomings of assembly languages
lengthy
machine-dependent
not portable

© Longman Hong Kong Education Page11


Computer and Information
Technology for (HKCEE)
Core module: Part D

13.3.2 High-level programming


languages
Features of high-level programming language
English-like instructions
single instruction defines many operations at the
machine level
easier to learn than machine or assembly
languages
should be converted to machine language before
execution

© Longman Hong Kong Education Page12


Computer and Information
Technology for (HKCEE)
Core module: Part D

13.3.2 High-level programming


languages
Examples of high-level programming
languages
FORTRAN
COBOL
BASIC
Pascal
Ada
C
C++
Java
© Longman Hong Kong Education Page13
Computer and Information
Technology for (HKCEE)
Core module: Part D

13.4 Assembler, Compiler and


Interpreter
Assembler
Assembler
Assembly Machine
instruction code

© Longman Hong Kong Education Page14


Computer and Information
Technology for (HKCEE)
Core module: Part D

13.4 Assembler, Compiler and


Interpreter
Compiler
compiler
Source Object
program code

© Longman Hong Kong Education Page15


Computer and Information
Technology for (HKCEE)
Core module: Part D

13.4 Assembler, Compiler and


Interpreter
IDE editors

Turbo C
Visual Basic

© Longman Hong Kong Education Page16


Computer and Information
Technology for (HKCEE)
Core module: Part D

13.4 Assembler, Compiler and


Interpreter
Interpreter
interpreter
Source
program Results
+ Data

© Longman Hong Kong Education Page17


Computer and Information
Technology for (HKCEE)
Core module: Part D

13.4 Assembler, Compiler and


Interpreter
Advantages of interpreter
compilation stage is omitted when generating
machine instructions
immediately execute high-level programs
ideal for small programming tasks
used in education because of interactivity

© Longman Hong Kong Education Page18


Computer and Information
Technology for (HKCEE)
Core module: Part D

13.4 Assembler, Compiler and


Interpreter
Examples of interpreter-typed programming
languages
JavaScript
VBScript
Python

© Longman Hong Kong Education Page19


Computer and Information Technology for (HKCEE) Core Module

END

Potrebbero piacerti anche