ENGR. SHOAIB ASLAM Computer Programming I Lecture 02.

Slides:



Advertisements
Similar presentations
CHAPTER 2 GC101 Program’s algorithm 1. COMMUNICATING WITH A COMPUTER  Programming languages bridge the gap between human thought processes and computer.
Advertisements

The Assembly Language Level
ICS103 Programming in C Lecture 1: Overview of Computers & Programming
Lecture 1: Overview of Computers & Programming
Compilers and Language Translation
SYSTEM PROGRAMMING & SYSTEM ADMINISTRATION
Copyright © 2002 W. A. Tucker1 Chapter 1 Lecture Notes Bill Tucker Austin Community College COSC 1315.
CHAPTER 1: AN OVERVIEW OF COMPUTERS AND LOGIC. Objectives 2  Understand computer components and operations  Describe the steps involved in the programming.
Chapter 5: Elementary Data Types Properties of types and objects –Data objects, variables and constants –Data types –Declarations –Type checking –Assignment.
COSC 120 Computer Programming
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
Computers: Tools for an Information Age
1 Key Concepts:  Why C?  Life Cycle Of a C program,  What is a computer program?  A program statement?  Basic parts of a C program,  Printf() function?
Programming Logic and Design, Introductory, Fourth Edition1 Understanding Computer Components and Operations (continued) A program must be free of syntax.
CS 104 Introduction to Computer Science and Graphics Problems Software and Programming Language (2) Programming Languages 09/26/2008 Yang Song (Prepared.
Copyright © 2001 by Wiley. All rights reserved. Chapter 1: Introduction to Programming and Visual Basic Computer Operations What is Programming? OOED Programming.
1 Programming Languages Examples: C, Java, HTML, Haskell, Prolog, SAS Also known as formal languages Completely described and rigidly governed by formal.
Chapter 1: Introduction To Computer | SCP1103 Programming Technique C | Jumail, FSKSM, UTM, 2005 | Last Updated: July 2005 Slide 1 Introduction To Computers.
Compiled by Benjamin Muganzi 3.2 Functions and Purposes of Translators Computing 9691 Paper 3 1.
Copyright 2003 Scott/Jones Publishing Brief Version of Starting Out with C++, 4th Edition Chapter 1 Introduction to Computers and Programming.
CS102 Introduction to Computer Programming
1 Chapter-01 Introduction to Computers and C++ Programming.
CCSA 221 Programming in C CHAPTER 2 SOME FUNDAMENTALS 1 ALHANOUF ALAMR.
CHAPTER 4: INTRODUCTION TO COMPUTER ORGANIZATION AND PROGRAMMING DESIGN Lec. Ghader Kurdi.
Learning Objectives Data and Information Six Basic Operations Computer Operations Programs and Programming What is Programming? Types of Languages Levels.
สาขาวิชาเทคโนโลยี สารสนเทศ คณะเทคโนโลยีสารสนเทศ และการสื่อสาร.
High level & Low level language High level programming languages are more structured, are closer to spoken language and are more intuitive than low level.
INTRODUCTION TO COMPUTING CHAPTER NO. 06. Compilers and Language Translation Introduction The Compilation Process Phase 1 – Lexical Analysis Phase 2 –
Chapter 1: Introduction to Computers and Programming.
IT253: Computer Organization Lecture 4: Instruction Set Architecture Tonga Institute of Higher Education.
Chapter 1: Preliminaries. Objectives In this chapter, you will learn about: Unit analysis Exponential and scientific notations Software development Algorithms.
Chapter 10: Compilers and Language Translation Invitation to Computer Science, Java Version, Third Edition.
INTRODUCTION TO PROGRAMMING, ALGORITHMS & FLOWCHARTS Programming in C2 CHAPTER 1.
1 History of compiler development 1953 IBM develops the 701 EDPM (Electronic Data Processing Machine), the first general purpose computer, built as a “defense.
DEPARTMENT OF COMPUTER SCIENCE & TECHNOLOGY FACULTY OF SCIENCE & TECHNOLOGY UNIVERSITY OF UWA WELLASSA 1 CST 221 OBJECT ORIENTED PROGRAMMING(OOP) ( 2 CREDITS.
Software Overview. Why review software? Software is the set of instructions that tells hardware what to do The reason for hardware is to execute a program.
TMF1013 : Introduction To Computing Lecture 1 : Fundamental of Computer ComputerFoudamentals.
Introduction to Java Applications Part II. In this chapter you will learn:  Different data types( Primitive data types).  How to declare variables?
Getting Started with MATLAB 1. Fundamentals of MATLAB 2. Different Windows of MATLAB 1.
INTRODUCTION TO COMPUTING CHAPTER NO. 04. Programming Languages Program Algorithms and Pseudo Code Properties and Advantages of Algorithms Flowchart (Symbols.
Chapter 1 Introduction Chapter 1 Introduction 1 st Semester 2015 CSC 1101 Computer Programming-1.
Basic of Programming Language Skill Area Computer System Computer Program Programming Language Programmer Translators.
Module 4 Part 2 Introduction To Software Development : Programming & Languages Introduction To Software Development : Programming & Languages.
Chapter 3 Syntax, Errors, and Debugging Fundamentals of Java.
Chapter One An Introduction to Programming and Visual Basic.
Programming Fundamentals. Overview of Previous Lecture Phases of C++ Environment Program statement Vs Preprocessor directive Whitespaces Comments.
The Instruction Set Architecture. Hardware – Software boundary Java Program C Program Ada Program Compiler Instruction Set Architecture Microcode Hardware.
Computer and Programming. Computer Basics: Outline Hardware and Memory Programs Programming Languages and Compilers.
Introduction to Java Applications Part II. In this chapter you will learn:  Different data types( Primitive data types).  How to declare variables?
Skill Area 311 Part B. Lecture Overview Assembly Code Assembler Format of Assembly Code Advantages Assembly Code Disadvantages Assembly Code High-Level.
Lecture #1: Introduction to Algorithms and Problem Solving Dr. Hmood Al-Dossari King Saud University Department of Computer Science 6 February 2012.
PROGRAMMING FUNDAMENTALS INTRODUCTION TO PROGRAMMING. Computer Programming Concepts. Flowchart. Structured Programming Design. Implementation Documentation.
Review A program is… a set of instructions that tell a computer what to do. Programs can also be called… software. Hardware refers to… the physical components.
Introduction to Computer Programming Concepts M. Uyguroğlu R. Uyguroğlu.
Some of the utilities associated with the development of programs. These program development tools allow users to write and construct programs that the.
Programming Languages
Software Engineering Algorithms, Compilers, & Lifecycle.
PROGRAMMING (1) LECTURE # 1 Programming and Languages: Telling the Computer What to Do.
Victoria Ibarra Mat:  Generally, Computer hardware is divided into four main functional areas. These are:  Input devices Input devices  Output.
Component 1.6.
Operating System Interface between a user and the computer hardware
CSCI-235 Micro-Computer Applications
Computer Programming.
ICS103 Programming in C Lecture 1: Overview of Computers & Programming
Lecture 2 Introduction to Programming
Compiler Construction
Chapter 1 Introduction(1.1)
Chapter One: An Introduction to Programming and Visual Basic
Introduction to Computer Programming
Chapter 1: Preliminaries
Presentation transcript:

ENGR. SHOAIB ASLAM Computer Programming I Lecture 02

Contents Computer Languages Machine Languages Algorithms Compiler Interpreter Assembler

Computer Languages What is a Language…? human beings communicate with each others in different language such as Urdu, French, Punjabi and Arabic etc. to communicate with the computers we have to use specific languages hundreds of languages have been develop in which few of them has gained international reputation. C language is one of them

TYPES Basically, languages are divided into two categories according to their interpretation. Low Level Languages High Level Languages Computer Languages

Low Level Languages Low level computer languages are machine codes or close to it. Computer cannot understand instructions given in high level languages or in English. It can only understand and execute instructions given in the form of machine language i.e. language of 0 and 1. There are two types of low level languages: Machine Language Assembly Language

Machine Language Lowest and most elementary level of Programming language First type of programming language to be Developed. It is basically the only language which computer Can understand. In fact, a manufacturer designs a computer to obey just one Language, its machine code, which is represented inside the computer by a String of binary digits (bits) 0 and 1. The symbol 0 stands for the absence of Electric pulse and 1 for the presence of an electric pulse. Since a computer is Capable of recognizing electric signals, therefore, it understand machine Language. Low Level Languages

Assembly Language Also low level but a very important language in which operation codes and operands are given in the form of alphanumeric symbols instead of 0’s and l’s. These alphanumeric symbols will be known as mnemonic codes and can have maximum up to 5 letter combination e.g. ADD for addition, SUB for subtraction, START,LABEL etc. Because of this feature it is also known as ‘Symbolic Programming Language’. Low Level Languages

Assembly Language (Cont..) This language is also very difficult and needs a lot of practice to master it because very small English support is given to this language. The language mainly helps in compiler orientations. The instructions of the Assembly language will also be converted to machine codes by language translator to be executed by the computer. Low Level Languages

High Level Language

User Friendly High level computer languages give formats close to English language Purpose of developing high level languages is to enable people to write programs easily and in their own native language environment (English). High-level languages are basically symbolic languages that use English words and/or mathematical symbols rather than mnemonic codes. Each instruction in the high level language is translated into many machine language instructions thus showing one-to-many translation

Types of High Level Languages 1. Algebraic Formula-Type Processing: computational procedures for solving mathematical and statistical problem i. BASIC (Beginners All Purpose Symbolic Instruction Code). ii. FORTRAN (Formula Translation). iii. PL/I (Programming Language, Version 1). iv. ALGOL (Algorithmic Language). v. APL (A Programming Language). 2. Business Data Processing: maintaining data processing procedures and files handling problems. i. COBOL (Common Business Oriented Language). ii. RPG (Report Program Generator

3. String and List Processing: These are used for string manipulation including search for patterns, inserting and deleting characters. Examples are: i. LISP (List Processing). ii. Prolog (Program in Logic). 4. Object Oriented Programming Language: In OOP, the computer program is divided into objects. Examples are: i. C++ ii. Java 5. Visual programming language: these are designed for building Windows-based applications Examples are: i. Visual Basic ii. Visual Java iii. Visual C Types of High Level Languages (Cont…)

Algorithms "a set of rules that precisely defines a sequence of operations” effective method expressed as a finite list of well-defined instructions for calculating a function. Starting from an initial state and initial input (perhaps empty), the instructions describe a computation that, when executed, proceeds through a finite number of well-defined successive states, eventually producing "output“ and terminating at a final ending state.

Algorithms (Cont…)

Expressing Algorithms Natural language expressions of algorithms tend to be verbose and ambiguous, and are rarely used for complex or technical algorithms. Pseudocode, flowcharts and control tables are structured ways to express algorithms that avoid many of the ambiguities common in natural language statements. Programming languages are primarily intended for expressing algorithms in a form that can be executed by a computer, but are often used as a way to define or document algorithms. Algorithms (Cont…)

In computer systems, an algorithm is basically an instance of logic written in software by software developers to be effective for the intended "target" computer(s) for the target machines to produce output from given input. Algorithms (Cont…)

Compiler A compiler is a computer program (or set of programs) that transforms source code written in a programming language (the source language) into another computer language (the target language, often having a binary form known as object code). The most common reason for wanting to transform source code is to create an executable program.

Compilers bridge source programs in high-level languages with the underlying hardware. A compiler requires ; i. determining the correctness of the syntax of programs, ii. generating correct and efficient object code, iii. run-time organization, iv. formatting output according to assembler and/or linker conventions. Compiler (Cont…)

Structure of Compiler The front end checks whether the program is correctly written in terms of the programming language syntax and semantics. Errors are reported if any, in a useful way. The frontend then generates an intermediate representation or IR of the source code for processing by the middle-end. The middle end is where optimization takes place. Typical transformations for optimization are removal of useless or unreachable code, discovery and propagation of constant values, relocation of computation to a less frequently executed place (e.g., out of a loop), or specialization of computation based on the context. The back end is responsible for translating the IR from the middle- end into assembly code. The target instruction(s) are chosen for each IR instruction. Register allocation assigns processor registers for the program variables where possible Compiler (Cont…)

Interpreter Computer program that executes, i.e. performs, instructions written in a programming language. An interpreter generally uses one of the following strategies for program execution:  execute the source code directly  translate source code into some efficient intermediate representation and immediately execute this  explicitly execute stored precompiled code made by a compiler which is part of the interpreter system

Interpreter VS Compiler Programs are usually written in high level code, which has to be converted into machine code for the CPU to execute it. This conversion is done by either a compiler or an interpreter. A compiler makes the conversion just once, while an interpreter typically converts it every time a program is executed (or in some languages like early versions of BASIC, every time a single instruction is executed).

Assembler A computer program which translates from assembly language to an object file or machine language format. An assembler creates object code by translating assembly instruction mnemonics into opcodes, and by resolving symbolic names for memory locations and other entities. The use of symbolic references is a key feature of assemblers, saving tedious calculations and manual address updates after program modifications

Data & Information Facts, figures, values, pictures in raw form Information: Facts, figures, values, pictures in well organized form

TypeExplanationTypeExplanation char smallest addressable unit of the machine that can contain basic character set. It is an integer type. Actual type can be either signed or unsigned depending on implementation signed char same as char, but guaranteed to be signed. unsigned char same as char, but guaranteed to be unsigned. short short int signed short signed short int short signed integer type. At least 16 bits in size. unsigned short unsigned short int same as short, but unsigned. int signed int basic signed integer type. At least 16 bits in size. unsigned unsigned int same as int, but unsigned. long long int signed long signed long int long signed integer type. At least 32 bits in size. unsigned long unsigned long int same as long, but unsigned. long long long long int signed long long signed long long in t long long signed integer type. At least 64 bits in size. unsigned long long unsigned long long i nt same as long long, but unsigned. float (single precision) floating- point type.

double double precision floating-point type. long double extended precision floating-point type.