You are on page 1of 14

COMPUTER PROGRAMMING CONCEPTS

School of Engineering & Architecture COMP1 AL 7/30/2010 jnb

COMPUTER PROGRAMMING
Computer

science discipline dealing with the creation and maintenance of computer programs.

One

activity in the complex field of software engineering

SOFTWARE
programs

or instructions that make the computer work.


System Software 2. Applications Software
1.

TYPES

PROGRAMMING LANGUAGE
special-purpose

language used to create and maintain programs by a well-defined set of rules


syntax (grammar): specifies ways in which language elements can be combined to create valid programs semantics (meaning): specifies how a program behaves

specified

programming

language rules are more strict than natural language rules

PROGRAMMING LANGUAGE
(CATEGORIES)
by

level - how close the instructions are to ML


high-level language (HLL): human-like; uses English-like terms; one HLL instruction = many ML instructions low-level language (LLL): machine-like; uses mnemonics or opcodes; almost one-to-one instruction correspondence between LLL and ML

MACHINE LANGUAGE (ML)

native language of a computer

ML is made up of very simple instructions. (add two numbers, jump to a program statement, fetch data from memory, store data to memory, etc.)
computers are powerful since they execute millions of ML per second.

ML is machine readable but is typically not readily understandable by humans.

MACHINE LANGUAGE (ML)


-programming the computer by entering only the binary/
hexadecimal operation codes. BINARY CODE HEX CODE COMMENTS

00111110 00110010 3E 32 11010011 00000101 D3 05

// LOAD ACCUMULATOR WITH 32H // OUTPUT THE CONTENT TO PORT 5 // HALT

01110110

76

LOW LEVEL LANGUAGE


Assembly
-

Language

Mnemonics (abbreviations for the instruction operation codes-[opcodes]) are being entered in programming the computer. MNEMONICS MVI A, 32H
OUT 5

COMMENTS LOAD ACCUMULATOR WITH 32H


OUTPUT THE CONTENTS TO I/O PORT 5 HALT

HLT

HIGH LEVEL LANGUAGE


Pascal

Language

var x, y, z : integer; begin x := 10; y := 3; if y <> 0 then z := x div y; end.

HIGH LEVEL LANGUAGE


BASIC

Language

10 INPUT N1,N2 20 PRINTSUM = ; N1 + N2 30 END

HIGH LEVEL LANGUAGE


C

Language

# include <stdio.h> # include<conio.h> main(){ printf(Hello World!); getch();}

HIGH LEVEL LANGUAGE


Java

Language

public class gg { public static void main(String[] args) { System.out.println("Hello World!"); }

PROGRAM TRANSLATION
conversion

of a program (called the source code) written in some programming language to its equivalent program (called executable, or object code) in the machine language of a target computer ILLUSTRATION:
SOURCE CODE
IN

PROGRAM TRANSLATION

ML

1110111011

PROGRAM TRANSLATION
categories:

compilers:

translates an entire source code(high level language program) to the equivalent object or executable code translates assembly language to ML

assemblers:

You might also like