Programming for A2 Computing

Download Report

Transcript Programming for A2 Computing

Programming for A2 Computing
High Level Languages
By David Halliday
Module 4
High and Low Level languages
• High Level languages
• Examples:
– C, C++
– Pascal
– BASIC
• Portable (can be compiled on
different systems)
• Problem oriented (designed
around solving different types
of problem)
• Statements resemble English
language (formalised)
• Low level Languages
• Examples
– Assembly
• Machine Oriented: designed
for individual machine or
processor architectures
• Each statement translates into
one machine instruction
• Statements resemble machine
instructions in mnemonics
High Level Language Facilities
• Selection statements:
– If, Then, Else, Case
• Iteration (repetition) statements:
– While...EndWhile, Repeat...Until, For… EndFor
• Built in/Library routines, functions and enumerated data
types to simplify I/O
– Readln, writeln
– Sqr, log
– String, Array, Record
High Level Language Paradigms
• High level languages often fit into one of 3 categories
– Imperative (procedural)
• Imperative programs explicitly specify an algorithm to achieve a goal
• Examples include:
– C, C++
– Pascal
– Fortran
– Declarative
• Declarative programs explicitly specify the goal and leave the
implementation of the algorithm to the support software
• Examples include:
– Prolog
– Functional
• Emphasizes the application of functions, unlike imperative programming,
which emphasizes changes in state and the execution of sequential
commands.
• Examples include:
– Haskell
Imperative (procedural) Languages
•
•
•
•
Imperative programs explicitly specify an algorithm to achieve a goal
They are concerned with changing of states of variables in memory
The closest paradigm to assembly/machine code
Problem Oriented… They are developed to solve particular types of
problem:
– FORTRAN (FORmula TRANslation)
• dev'd in 1950s for use in scientific and engineering
– COBOL (COmmon Business Oriented Language)
• dev'd in 1950s for data processing (first to use records)
– 'C‘
• developed in 1972 by Dennis Ritchie at the Bell Telephone Laboratories for
use with the Unix operating system.
– Pascal
• dev'd in 1970s to teach structured programming
• Extended by Boreland with Delphi making a useful RAD tool
Embedded systems
• Computer is component in a larger system.
• Examples include:
–
–
–
–
microprocessor-controlled washing machine or video recorder;
a modern jet aircraft;
a system for controlling traffic lights;
a process control system for controlling the flow of water along a
pipe by means of a valve;
– a robot used in a car assembly plant.
– Modern mobile phones
Criteria for Selecting a Language
• The nature of the application;
• The availability of facilities within the language for
implementing the software design;
• The availability of a suitable compiler/interpreter for the
hardware;
• The expertise of the programmers.
Homework
• Heathcote Chapter 35 Page 219 All Questions