Chapter 15 Programming Languages - PowerPoint PPT Presentation

1 / 24
About This Presentation
Title:

Chapter 15 Programming Languages

Description:

15.2 Development of Programming Languages 81. 15.3 High-level Programming ... VBScript and JavaScript. have similar syntax as Visual Basic and Java respectively ... – PowerPoint PPT presentation

Number of Views:24
Avg rating:3.0/5.0
Slides: 25
Provided by: raymon102
Category:

less

Transcript and Presenter's Notes

Title: Chapter 15 Programming Languages


1
Chapter 15 Programming Languages
  • 15.1 Roles of a Programming Language 81
  • 15.2 Development of Programming Languages 81
  • 15.3 High-level Programming Languages 86
  • 15.4 Translator 88

2
15.1 The Roles of a Programming Language
Chapter 15 Programming Languages
  • Programming Language
  • Interface between machine and programmer
  • Computer handles bits and bytes
  • Has its own words and syntax
  • Syntax
  • is a set of rules that govern how the words are
    put together to form a Statement
  • Programmers must obey syntax
  • Algorithms
  • ordered steps recorded on paper
  • Programming
  • realises algorithm

3
15.2 Development of Programming Languages
Chapter 15 Programming Languages
  • A. Low level Programming Language
  • 1. First Generation Language
  • 2. Second Generation Language
  • B. High level Programming Language
  • 1. Third Generation Language (3GL)
  • 2. Fourth Generation Language (4GL)
  • C. Comparison High Low Level languages

4
15.2.1 Low-level programming languages
15.2 Development of Programming Languages
  • Low-level programming languages
  • include
  • Machine languages and
  • Assembly languages
  • Machine dependent
  • e.g. programs written in low-level languages for
    IBM PC cannot be run in a Macintosh computer
  • Control hardware
  • e.g. Driver programs are written in low-level
    languages.
  • Programs written in low-level languages are
    usually
  • small in size and
  • efficient.

5
15.2.1.1 First generation languages (1)
15.2 Development of Programming Languages
  • The first generation programming languages
  • Machine languages
  • Defined by the hardware design of the computer
  • Machine dependent.
  • Instruction formed by binary digits (0or 1)
  • Corresponding to an ON or OFF state of an
    electric circuit

6
15.2.1.1 First generation languages (2)
15.2 Development of Programming Languages
  • Machine Instruction has two parts
  • op code operation to be performed
  • a verb
  • (e.g. increment, add, copy, etc)
  • operand data to be acted on
  • a noun
  • (e.g. In incrementing the value of A, A is the
    operand)
  • Operand may be a value or
  • an address of memory location

7
15.2.1.2 Second generation languages
15.2 Development of Programming Languages
  • Second generation language
  • Assembly languages
  • Instructions are 11 with machine instructions
  • Symbolic instruction code (or mnemonics)
  • Using symbolic instruction code to replace binary
    digits.
  • Meaningful abbreviations that substitute the op
    code
  • e.g. JMP A means jump to address represented by
    A.
  • Low-level languages
  • Machine languages and assembly languages

8
15.2.2 High-Level Programming Languages
15.2 Development of Programming Languages
  • High-level languages
  • Machine-independent
  • Third generation languages or above
  • More like human languages
  • Let programmers concentrate on the logic
  • Rather than machine architecture

9
15.2.2.1 Third generation language (3GL)
15.2 Development of Programming Languages
  • More human like than assembly language
  • Meet demand of efficiency and effectiveness
  • Examples
  • C, Fortran, COBOL, BASIC, PASCAL etc.
  • Each high-level language statement is translated
    into many machine instructions

10
15.2.2.2 Fourth generation language (4GL)
15.2 Development of Programming Languages
  • Each 4GL instruction represents many 3GL
    statements
  • Typical example SQL (Structured Query Language)
  • e.g.
  • SELECT FROM student ORDER BY class,
    class_no
  • will display all the records in table Student
    in ascending order of class and class_no.
  • If the same task is written in a 3GL,
    instructions have to be written
  • Sort the records in ascending order of class and
    class_no
  • Get each record, test for end of file, put each
    item on screen
  • Go back and repeat the operation until no more
    records to process

11
15.2.3 Comparing Low High-level Languages (1)
15.2 Development of Programming Languages
  • 1. Advantages of high-level language

12
15.2.3 Comparing Low High-level Languages (2)
15.2 Development of Programming Languages
  • 2. Advantages of low-level language

13
15.3 Examples of High Level Languages (1)
Chapter 15 Programming Languages
  • High Level Languages
  • Designed to solve different problems
  • Ranging from business to games
  • Some common programming languages
  • 1. PASCAL
  • Designed for teaching structured programming
  • Popular in schools

14
15.3 Examples of High Level Languages (2)
Chapter 15 Programming Languages
  • 2. C
  • Designed to operate computer at low-level using
    high level language
  • More readable and better structured than Assembly
    language
  • 3. Java
  • Includes some syntax of C
  • Java programs can be called from HTML document or
    run directly
  • Computer needs Java Virtual Machine to execute
    Java Programs

15
15.3 Examples of High Level Languages (3)
Chapter 15 Programming Languages
  • 4. COBOL
  • Designed for business applications
  • Wordy language
  • Readable for beginners
  • e.g.
  • multiply hourly-rate by hours-worked
    giving gross-pay
  • But, can be clumsy for long programs

16
15.3 Examples of High Level Languages (4)
Chapter 15 Programming Languages
  • 5. BASIC
  • Designed to provide students with an
    easy-to-learn language.
  • Visual Basic
  • A version of BASIC
  • Specialised for developing Windows applications
  • Belong to Rapid Application Development (RAD)
  • Programming can be done by drag-and-drop
  • Programmers can quickly build an application
  • Visual Basic.NET
  • Newest version of Visual Basic
  • Supports all Web-based features

17
15.3 Examples of High Level Languages (5)
Chapter 15 Programming Languages
  • 6. Script Languages
  • Interpreted and processed by a software (e.g.
    Browser)
  • Rather than a computer
  • e.g.
  • VBScript and JavaScript
  • have similar syntax as Visual Basic and Java
    respectively
  • Interpreted and processed by Web browser
  • Instructions are embedded in HTML documents
  • Increasing the function of HTML
  • Making Web pages more interactive

18
15.4 Translators (1)
Chapter 15 Programming Languages
  • Source program
  • Text file
  • Storing source code
  • Must be translated into machine instructions
    before execution
  • Translator
  • A software
  • to convert source code into machine instructions
  • Discover syntax errors of a program

19
15.4 Translators (2)
Chapter 15 Programming Languages
  • Object program
  • Binary file
  • Storing machine instructions
  • During execution, needs the object program only
  • A. Assembler
  • B. Compiler
  • C. Interpreter
  • D. Trend in Translators
  • E. Comparison of Translators

20
15.4.1 Assemblers
15.4 Translators
  • A. Assembler
  • A software
  • Translate assembly language program into machine
    instructions
  • Producing one machine instruction for each
    assembly language statement
  • Translate the whole source program before
    execution
  • Storing the results in an object program
  • During execution, need the object program only

21
15.4.2 Compilers
15.4 Translators
  • B. Compiler
  • A software
  • Translate high-level language program into
    machine instructions
  • Translate the whole source program before
    execution
  • Storing the results in an object program
  • During execution, need the object program only

22
15.4.3 Interpreters
15.4 Translators
  • C. Interpreter
  • A software for
  • translating ONE high-level language program
    statement at a time
  • send to the computer for execution
  • then proceed to the NEXT statement
  • No object program is produced
  • When program is run, the following must be
    present
  • interpreter and source code.
  • Interpreted program runs slower than compiled
    ones
  • Because time is spent on translation
  • Like by programmers
  • more convenient in testing

23
15.4.4 Trend in translators
15.4 Translators
  • Portability of programs
  • The same program can be run on different OS
    without re-compilation
  • Java
  • Portable
  • Source code of a Java program are not compiled
    into machine instructions
  • But, compiled into intermediate code (bytecode)
  • The object programs with bytecode are interpreted
    by an interpreter (called Java Virtual Machine,
    JVM)
  • Users have to install JVM before use
  • Microsofts Visual Studio.net use similar approach

24
15.4.5 Comparison of Translators
15.4 Translators
Write a Comment
User Comments (0)
About PowerShow.com