SlideShare a Scribd company logo
1 of 24
COMPUTER PRESENTATION
PRESENTED BY
ASHIQUE ALI
BAKHAT ALI
MAHEEN MUNEER
NOOR JAAN
Outline of Topics
• Hardware/Software interface
– Layers of the Machine
– Kinds of Software
• Computer Languages
• Syntax, Semantics, Grammars
• What happens to your program?
– Compilation, Linking, Execution
– Program errors
• Compilation vs. Interpretation etc.
Software Categories
• System SW
–Programs written for computer systems
• Compilers, operating systems, …
• Application SW
–Programs written for computer users
• Word-processors, spreadsheets, & other
application packages
A Layered View of the Computer
Machine with all its hardware
System Software
Compilers, Interpreters,Preprocessors,
etc.
Operating System, Device Drivers
Application Programs
Word-Processors, Spreadsheets,
Database Software, IDEs,
etc…
Operating System (OS)
 Provides several essential services:
– Loading & running application programs
– Allocating memory & processor time
– Providing input & output facilities
– Managing files of information
Programs
• Programs are written in programming languages
– PL = programming language
– Pieces of the same program can be written in different
PLs
• Languages closer to the machine can be more efficient
• As long as they agree on how to communicate
• A PL is
– A special purpose and limited language
– A set of rules and symbols used to construct a
computer program
– A language used to interact with the computer
Computer Languages
– Machine Language
• Uses binary code
• Machine-dependent
• Not portable
• Assembly Language
– Uses mnemonics
– Machine-dependent
– Not usually portable
• High-Level Language (HLL)
– Uses English-like language
– Machine independent
– Portable (but must be compiled for different platforms)
– Examples: Pascal, C, C++, Java, Fortran, . . .
Machine Language
• The representation of a computer program which is
actually read and understood by the computer.
– A program in machine code consists of a sequence of machine
instructions.
• Instructions:
– Machine instructions are in binary code
– Instructions specify operations and memory cells involved in the
operation
Example: Operation Address
0010 0000 0000 0100
0100 0000 0000 0101
0011 0000 0000 0110
Assembly Language
• A symbolic representation of the machine language of a
specific processor.
• Is converted to machine code by an assembler.
• Usually, each line of assembly code produces one
machine instruction (One-to-one correspondence).
• Programming in assembly language is slow and error-
prone but is more efficient in terms of hardware
performance.
• Mnemonic representation of the instructions and data
• Example:
Load Price
Add Tax
Store Cost
High-level language
• A programming language which use statements
consisting of English-like keywords such as "FOR",
"PRINT" or “IF“, ... etc.
• Each statement corresponds to several machine
language instructions (one-to-many correspondence).
• Much easier to program than in assembly language.
• Data are referenced using descriptive names
• Operations can be described using familiar symbols
• Example:
Cost := Price + Tax
Syntax & Semantics
• Syntax:
– The structure of strings in some language. A
language's syntax is described by a grammar.
– Examples:
• Binary number
<binary_number> = <bit> | <bit> <binary_number>
<bit> = 0 | 1
• Identifier
<identifier> = <letter> {<letter> | <digit> }
<letter> = a | b | . . . | z
<digit = 0 | 1 | . . . | 9
• Semantics:
– The meaning of the language
Syntax & Grammars
• Syntax descriptions for a PL are
themselves written in a formal language.
– E.g. Backus-Naur Form (BNF)
• The formal language is not a PL but it can
be implemented by a compiler to enforce
grammar restrictions.
• Some PLs look more like grammar
descriptions than like instructions.
Compilers & Programs
• Compiler
– A program that converts another program from
some source language (or high-level
programming language / HLL) to machine
language (object code).
– Some compilers output assembly language
which is then converted to machine language by
a separate assembler.
– Is distinguished from an assembler by the fact
that each input statement, in general,
correspond to more than one machine
instruction.
Compilation into Assembly L
Compiler
Assembler
Source
Program
Assembly
Language
Assembly
Language
Machine
Language
Compilers & Programs
• Source program
– The form in which a computer program,
written in some formal programming
language, is written by the programmer.
– Can be compiled automatically into object
code or machine code or executed by an
interpreter.
– Pascal source programs have extension
‘.pas’
Compilers & Programs
• Object program
– Output from the compiler
– Equivalent machine language translation of the
source program
– Files usually have extension ‘.obj’
• Executable program
– Output from linker/loader
– Machine language program linked with necessary
libraries & other files
– Files usually have extension ‘.exe’
What is a Linker?
• A program that pulls other programs together so
that they can run.
• Most programs are very large and consist of
several modules.
• Even small programs use existing code provided
by the programming environment called libraries.
• The linker pulls everything together, makes sure
that references to other parts of the program
(code) are resolved.
Running Programs
Memory
Input Data
Program Output
Machine language
program
(executable file)
Data entered
during execution
Computed results
C P U
• Steps that the computer goes through to run a
program:
Program Execution
• Steps taken by the CPU to run a program
(instructions are in machine language):
1. Fetch an instruction
2. Decode (interpret) the instruction
3. Retrieve data, if needed
4. Execute (perform) actual processing
5. Store the results, if needed
Program Errors
• Syntax Errors:
– Errors in grammar of the language
• Runtime error:
– When there are no syntax errors, but the program
can’t complete execution
• Divide by zero
• Invalid input data
• Logical errors:
– The program completes execution, but delivers
incorrect results
– Incorrect usage of parentheses
Compilation
Compiler
Target Program
Source
Program
Target
Program
Input Output
• Compiler translates source into target (a machine
language program)
• Compiler goes away at execution time
• Compiler is itself a machine language program,
presumably created by compiling some other high-level
program
• Machine language, when written in a format understood
by the OS is object code
Interpretation
Interpreter
Source
Program
Input
Output
• The interpreter stays around during execution
• It reads and executes statements one at a time
Compilation vs. Interpretation
• Compilation:
– Syntax errors caught before running the program
– Better performance
– Decisions made once, at compile time
• Interpretation:
– Better diagnostics (error messages)
– More flexibility
– Supports late binding (delaying decisions about
program implementation until runtime)
• Can better cope with PLs where type and size of
variables depend on input
– Supports creation/modification of program code on
the fly (e.g. Lisp, Prolog)
introduction computer programming languages

More Related Content

What's hot

High Level Language (HLL)
High Level Language (HLL)High Level Language (HLL)
High Level Language (HLL)Maliha Jahan
 
Generation of computer languages
Generation of computer languagesGeneration of computer languages
Generation of computer languageskitturashmikittu
 
Types of Programming Languages
Types of Programming LanguagesTypes of Programming Languages
Types of Programming LanguagesJuhi Bhoyar
 
introduction to programming languages
introduction to programming languagesintroduction to programming languages
introduction to programming languagesNaqashAhmad14
 
Intro To Programming Concepts
Intro To Programming ConceptsIntro To Programming Concepts
Intro To Programming ConceptsJussi Pohjolainen
 
Introduction to computer programming
Introduction to computer programmingIntroduction to computer programming
Introduction to computer programmingNSU-Biliran Campus
 
Programming Fundamental Presentation
Programming Fundamental PresentationProgramming Fundamental Presentation
Programming Fundamental Presentationfazli khaliq
 
Introduction to programming
Introduction to programmingIntroduction to programming
Introduction to programmingGwyneth Calica
 
Programming languages
Programming languagesProgramming languages
Programming languagesSimon Mui
 
Programming Paradigm & Languages
Programming Paradigm & LanguagesProgramming Paradigm & Languages
Programming Paradigm & LanguagesGaditek
 
Programming language
Programming languageProgramming language
Programming languageShuja Qais
 
Programming Fundamentals lecture 2
Programming Fundamentals lecture 2Programming Fundamentals lecture 2
Programming Fundamentals lecture 2REHAN IJAZ
 

What's hot (20)

High Level Language (HLL)
High Level Language (HLL)High Level Language (HLL)
High Level Language (HLL)
 
Generation of computer languages
Generation of computer languagesGeneration of computer languages
Generation of computer languages
 
Types of Programming Languages
Types of Programming LanguagesTypes of Programming Languages
Types of Programming Languages
 
introduction to programming languages
introduction to programming languagesintroduction to programming languages
introduction to programming languages
 
Intro To Programming Concepts
Intro To Programming ConceptsIntro To Programming Concepts
Intro To Programming Concepts
 
Introduction to computer programming
Introduction to computer programmingIntroduction to computer programming
Introduction to computer programming
 
Programming
ProgrammingProgramming
Programming
 
Programming : QBASIC
Programming : QBASICProgramming : QBASIC
Programming : QBASIC
 
Programming Fundamental Presentation
Programming Fundamental PresentationProgramming Fundamental Presentation
Programming Fundamental Presentation
 
Introduction to programming
Introduction to programmingIntroduction to programming
Introduction to programming
 
Computer Programming
Computer ProgrammingComputer Programming
Computer Programming
 
Programming languages
Programming languagesProgramming languages
Programming languages
 
Programming Paradigm & Languages
Programming Paradigm & LanguagesProgramming Paradigm & Languages
Programming Paradigm & Languages
 
Introduction to Compiler design
Introduction to Compiler design Introduction to Compiler design
Introduction to Compiler design
 
Programming language
Programming languageProgramming language
Programming language
 
Programming languages
Programming languagesProgramming languages
Programming languages
 
Computer Language
Computer LanguageComputer Language
Computer Language
 
Programming languages
Programming languagesProgramming languages
Programming languages
 
Programming Fundamentals lecture 2
Programming Fundamentals lecture 2Programming Fundamentals lecture 2
Programming Fundamentals lecture 2
 
Computer languages
Computer languagesComputer languages
Computer languages
 

Similar to introduction computer programming languages

Session01 basics programming
Session01 basics programmingSession01 basics programming
Session01 basics programmingHarithaRanasinghe
 
Embedded c c++ programming fundamentals master
Embedded c c++ programming fundamentals masterEmbedded c c++ programming fundamentals master
Embedded c c++ programming fundamentals masterHossam Hassan
 
Introduction to computer programming
Introduction to computer programming Introduction to computer programming
Introduction to computer programming VanessaBuensalida
 
4_5802928814682016556.pptx
4_5802928814682016556.pptx4_5802928814682016556.pptx
4_5802928814682016556.pptxAshenafiGirma5
 
Cd ch1 - introduction
Cd   ch1 - introductionCd   ch1 - introduction
Cd ch1 - introductionmengistu23
 
CD - CH1 - Introduction to compiler design.pptx
CD - CH1 - Introduction to compiler design.pptxCD - CH1 - Introduction to compiler design.pptx
CD - CH1 - Introduction to compiler design.pptxZiyadMohammed17
 
Compiler Design Introduction
Compiler Design IntroductionCompiler Design Introduction
Compiler Design IntroductionKuppusamy P
 
Week 08_Basics of Compiler Construction.pdf
Week 08_Basics of Compiler Construction.pdfWeek 08_Basics of Compiler Construction.pdf
Week 08_Basics of Compiler Construction.pdfAnonymousQ3EMYoWNS
 
Python-unit -I.pptx
Python-unit -I.pptxPython-unit -I.pptx
Python-unit -I.pptxcrAmth
 
Python-L1.pptx
Python-L1.pptxPython-L1.pptx
Python-L1.pptxDukeCalvin
 
Introduction_to_Programming.pptx
Introduction_to_Programming.pptxIntroduction_to_Programming.pptx
Introduction_to_Programming.pptxPmarkNorcio
 
Embedded firmware
Embedded firmwareEmbedded firmware
Embedded firmwareJoel P
 

Similar to introduction computer programming languages (20)

Session01 basics programming
Session01 basics programmingSession01 basics programming
Session01 basics programming
 
Chapter 4 computer language
Chapter 4 computer languageChapter 4 computer language
Chapter 4 computer language
 
df
dfdf
df
 
Embedded c c++ programming fundamentals master
Embedded c c++ programming fundamentals masterEmbedded c c++ programming fundamentals master
Embedded c c++ programming fundamentals master
 
Compilers.pptx
Compilers.pptxCompilers.pptx
Compilers.pptx
 
a1.pptx.pdf
a1.pptx.pdfa1.pptx.pdf
a1.pptx.pdf
 
sege.pdf
sege.pdfsege.pdf
sege.pdf
 
Introduction to computer programming
Introduction to computer programming Introduction to computer programming
Introduction to computer programming
 
4_5802928814682016556.pptx
4_5802928814682016556.pptx4_5802928814682016556.pptx
4_5802928814682016556.pptx
 
Cd ch1 - introduction
Cd   ch1 - introductionCd   ch1 - introduction
Cd ch1 - introduction
 
CD - CH1 - Introduction to compiler design.pptx
CD - CH1 - Introduction to compiler design.pptxCD - CH1 - Introduction to compiler design.pptx
CD - CH1 - Introduction to compiler design.pptx
 
programming.pptx
programming.pptxprogramming.pptx
programming.pptx
 
Compiler Design Introduction
Compiler Design IntroductionCompiler Design Introduction
Compiler Design Introduction
 
Week 08_Basics of Compiler Construction.pdf
Week 08_Basics of Compiler Construction.pdfWeek 08_Basics of Compiler Construction.pdf
Week 08_Basics of Compiler Construction.pdf
 
Python-unit -I.pptx
Python-unit -I.pptxPython-unit -I.pptx
Python-unit -I.pptx
 
Python-L1.pptx
Python-L1.pptxPython-L1.pptx
Python-L1.pptx
 
Computer languages
Computer languagesComputer languages
Computer languages
 
Introduction_to_Programming.pptx
Introduction_to_Programming.pptxIntroduction_to_Programming.pptx
Introduction_to_Programming.pptx
 
Embedded firmware
Embedded firmwareEmbedded firmware
Embedded firmware
 
Program Logic and Design
Program Logic and DesignProgram Logic and Design
Program Logic and Design
 

Recently uploaded

The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxVishalSingh1417
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdfVishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdfssuserdda66b
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Jisc
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxDr. Sarita Anand
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701bronxfugly43
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17Celine George
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...ZurliaSoop
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentationcamerronhm
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxVishalSingh1417
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...Poonam Aher Patil
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin ClassesCeline George
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 

Recently uploaded (20)

The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdfVishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 

introduction computer programming languages

  • 1. COMPUTER PRESENTATION PRESENTED BY ASHIQUE ALI BAKHAT ALI MAHEEN MUNEER NOOR JAAN
  • 2. Outline of Topics • Hardware/Software interface – Layers of the Machine – Kinds of Software • Computer Languages • Syntax, Semantics, Grammars • What happens to your program? – Compilation, Linking, Execution – Program errors • Compilation vs. Interpretation etc.
  • 3. Software Categories • System SW –Programs written for computer systems • Compilers, operating systems, … • Application SW –Programs written for computer users • Word-processors, spreadsheets, & other application packages
  • 4. A Layered View of the Computer Machine with all its hardware System Software Compilers, Interpreters,Preprocessors, etc. Operating System, Device Drivers Application Programs Word-Processors, Spreadsheets, Database Software, IDEs, etc…
  • 5. Operating System (OS)  Provides several essential services: – Loading & running application programs – Allocating memory & processor time – Providing input & output facilities – Managing files of information
  • 6. Programs • Programs are written in programming languages – PL = programming language – Pieces of the same program can be written in different PLs • Languages closer to the machine can be more efficient • As long as they agree on how to communicate • A PL is – A special purpose and limited language – A set of rules and symbols used to construct a computer program – A language used to interact with the computer
  • 7. Computer Languages – Machine Language • Uses binary code • Machine-dependent • Not portable • Assembly Language – Uses mnemonics – Machine-dependent – Not usually portable • High-Level Language (HLL) – Uses English-like language – Machine independent – Portable (but must be compiled for different platforms) – Examples: Pascal, C, C++, Java, Fortran, . . .
  • 8. Machine Language • The representation of a computer program which is actually read and understood by the computer. – A program in machine code consists of a sequence of machine instructions. • Instructions: – Machine instructions are in binary code – Instructions specify operations and memory cells involved in the operation Example: Operation Address 0010 0000 0000 0100 0100 0000 0000 0101 0011 0000 0000 0110
  • 9. Assembly Language • A symbolic representation of the machine language of a specific processor. • Is converted to machine code by an assembler. • Usually, each line of assembly code produces one machine instruction (One-to-one correspondence). • Programming in assembly language is slow and error- prone but is more efficient in terms of hardware performance. • Mnemonic representation of the instructions and data • Example: Load Price Add Tax Store Cost
  • 10. High-level language • A programming language which use statements consisting of English-like keywords such as "FOR", "PRINT" or “IF“, ... etc. • Each statement corresponds to several machine language instructions (one-to-many correspondence). • Much easier to program than in assembly language. • Data are referenced using descriptive names • Operations can be described using familiar symbols • Example: Cost := Price + Tax
  • 11. Syntax & Semantics • Syntax: – The structure of strings in some language. A language's syntax is described by a grammar. – Examples: • Binary number <binary_number> = <bit> | <bit> <binary_number> <bit> = 0 | 1 • Identifier <identifier> = <letter> {<letter> | <digit> } <letter> = a | b | . . . | z <digit = 0 | 1 | . . . | 9 • Semantics: – The meaning of the language
  • 12. Syntax & Grammars • Syntax descriptions for a PL are themselves written in a formal language. – E.g. Backus-Naur Form (BNF) • The formal language is not a PL but it can be implemented by a compiler to enforce grammar restrictions. • Some PLs look more like grammar descriptions than like instructions.
  • 13. Compilers & Programs • Compiler – A program that converts another program from some source language (or high-level programming language / HLL) to machine language (object code). – Some compilers output assembly language which is then converted to machine language by a separate assembler. – Is distinguished from an assembler by the fact that each input statement, in general, correspond to more than one machine instruction.
  • 14. Compilation into Assembly L Compiler Assembler Source Program Assembly Language Assembly Language Machine Language
  • 15. Compilers & Programs • Source program – The form in which a computer program, written in some formal programming language, is written by the programmer. – Can be compiled automatically into object code or machine code or executed by an interpreter. – Pascal source programs have extension ‘.pas’
  • 16. Compilers & Programs • Object program – Output from the compiler – Equivalent machine language translation of the source program – Files usually have extension ‘.obj’ • Executable program – Output from linker/loader – Machine language program linked with necessary libraries & other files – Files usually have extension ‘.exe’
  • 17. What is a Linker? • A program that pulls other programs together so that they can run. • Most programs are very large and consist of several modules. • Even small programs use existing code provided by the programming environment called libraries. • The linker pulls everything together, makes sure that references to other parts of the program (code) are resolved.
  • 18. Running Programs Memory Input Data Program Output Machine language program (executable file) Data entered during execution Computed results C P U • Steps that the computer goes through to run a program:
  • 19. Program Execution • Steps taken by the CPU to run a program (instructions are in machine language): 1. Fetch an instruction 2. Decode (interpret) the instruction 3. Retrieve data, if needed 4. Execute (perform) actual processing 5. Store the results, if needed
  • 20. Program Errors • Syntax Errors: – Errors in grammar of the language • Runtime error: – When there are no syntax errors, but the program can’t complete execution • Divide by zero • Invalid input data • Logical errors: – The program completes execution, but delivers incorrect results – Incorrect usage of parentheses
  • 21. Compilation Compiler Target Program Source Program Target Program Input Output • Compiler translates source into target (a machine language program) • Compiler goes away at execution time • Compiler is itself a machine language program, presumably created by compiling some other high-level program • Machine language, when written in a format understood by the OS is object code
  • 22. Interpretation Interpreter Source Program Input Output • The interpreter stays around during execution • It reads and executes statements one at a time
  • 23. Compilation vs. Interpretation • Compilation: – Syntax errors caught before running the program – Better performance – Decisions made once, at compile time • Interpretation: – Better diagnostics (error messages) – More flexibility – Supports late binding (delaying decisions about program implementation until runtime) • Can better cope with PLs where type and size of variables depend on input – Supports creation/modification of program code on the fly (e.g. Lisp, Prolog)