0% found this document useful (0 votes)
13 views

Chapter 4 Types of Programming Language Edited

Uploaded by

ekanshtoocaram8
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

Chapter 4 Types of Programming Language Edited

Uploaded by

ekanshtoocaram8
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

O Level Computer Science P1 Software: Programming Languages © N.

A DMC SC 2023

Types of programming language, translators and integrated development


environments (IDEs)
• Computers only ‘understand’ their own language, called machine code.
• A program needs to be translated into machine code before it can be ‘understood’ by
a computer.
• A computer program is a list of instructions that enable a computer to perform a
specific task.
• Computer programs can be written in high-level languages and low-level languages
depending on the task to be performed and the computer to be used.

in
High-level languages and low-level languages
High-level languages

st
A programming language that is independent of computer hardware.
• A program written in a HLL needs to be translated into machine code before it is
executed. u
Programs written in a high-level language are easier to:
g
i. read and understand as the language used is closer to English,
ii. write in a shorter time,
u

iii. debug at the development stage,


iv. maintain once in use.
A

The following snippet of program to add two numbers together is a single program
statement written in a typical high-level language:
r.

Sum = FirstNumber + SecondNumber


M

Low-level languages

• A programming language that is dependent on computer hardware.


• Both machine code and assembly language are low-level languages.

Machine code
A binary programming language written in machine code that can be loaded and executed
without translation.

Page 1 of 5
O Level Computer Science P1 Software: Programming Languages © N.A DMC SC 2023

The following snippet of program to add two numbers together is written in typical machine
code, shown in both hexadecimal and binary, and consists of three statements:

Differences between high-level and low-level languages

in
Language Advantages Disadvantages
i. Independent of the type of computer being used i. Programs can be larger
ii. Easier to read, write and understand programs ii. Programs can take longer to execute
High-Level iii. Quicker to write programs iii. Programs may not be able to make use of

st
iv. Programs are easier and quicker to debug special hardware
v. Easier to maintain programs in use u
i. Can make use of special hardware i. It takes a longer time to write and debug
ii. Includes special machine-dependent instructions programs
g
Low-level iii.Can write code that doesn’t take up much space in iii. Programs are more difficult to understand
primary memory
iv. Can write code that performs a task very quickly
u
A

Assembly languages

• A programming language that is dependent on computer hardware.


• A program written in an assembly language program needs to be translated into
r.

machine code before it is executed.


M

Low-Level Languages

Assembly Languages Machine Code

- Written using mnemonics and labels - Written in binary


- Needs translation before execution - Can be executed straight away

Page 2 of 5
O Level Computer Science P1 Software: Programming Languages © N.A DMC SC 2023

Programmers who write programs in an assembly language do so for the following reasons:
i. To make use of special hardware.
ii. To make use of special machine-dependent instructions.
iii. To write code that doesn’t take up much space in primary memory.
iv. To write code that performs a task very quickly.

The following snippet of program to add two numbers together is written in a typical
assembly language and consists of three statements:

in
st
Translators
A translator converts a program written in a high-level language program (or low-level
u
assembly language program) into machine code.
g
Types of translator program
i. Compiler
u

ii. Interpreter
iii. Assembler
A

Summary of Translation Programs


r.

in one go
M

Page 3 of 5
O Level Computer Science P1 Software: Programming Languages © N.A DMC SC 2023

Advantages and Disadvantages


Translators Advantages Disadvantages
Interpreter i. Easier and quicker to debug and test i. Programs cannot be run
programs during development. without the interpreter.
ii. Easier to edit programs during ii. Programs can take longer
development. to execute.
Compiler i. A compiled program can be stored i. It takes a longer time to
ready for use. write, test and debug
ii. A compiled program can be executed programs during
without the compiler. development.
iii. A compiled program takes up less
space in memory when it is executed.
iv. A compiled program is executed in a

in
shorter time.

Integrated Development Environment (IDE)

st
An IDE is a suite of software development tools used by programmers to aid the writing and
development of programs. u
IDEs usually have these features:
g
i. code editors
ii. a translator
u

iii. a runtime environment with a debugger


iv. error diagnostics
v. auto-completion
A

vi. auto-correction
vii. an auto-documenter and prettyprinting
r.

Code editor

• Allows a program to be written and edited without the need to use a separate text editor.
M

Translator

• Can be a compiler and/or an interpreter.


• Enables the program to be executed under the control of the IDE.

Runtime and debugger

• Runs a program under development.


• Allows a programmer to step through the program a line at a time.
• Allows a programmer to set breakpoints.
• Allow a programmer to check for logic errors in the program.

Page 4 of 5
O Level Computer Science P1 Software: Programming Languages © N.A DMC SC 2023

Error diagnostics

• Finds possible errors as the program code is being typed.

Auto-completion

• Context-sensitive prompts with text completion for variable names and reserved words.

Auto-correction

• Alerts the programmer to errors and provides suggested corrections.

Auto-documenter and prettyprinting

• Explains the function and purpose of key words.


• Prettyprinting colour codes the words in the program and lays the program out clearly.

in
st
u
g
u
A
r.
M

References: IGCSE Computer Science (D. Watson & H. Williams)

Page 5 of 5

You might also like