Programming Languages

Download Report

Transcript Programming Languages

Programming
Languages
CS 430/CS 530
Fall 2004
Professor Adams
Programming Languages
facilitate the expression and
communication of ideas between
people
 have a narrower expressive domain
than natural languages because they
only communicate algorithmic ideas
 enable communication of algorithms
between people and computers

Required definition of
an Algorithm

An algorithm is an unambiguous, stepby-step procedure for solving a
problem in a finite amount of time
using a finite amount of space
Categories of Language
Design Principles

Syntax
– context-free grammar

Type systems and semantics
– values that programs can manipulate
– meaning of programs
Memory management
 Exception handling

Memory Management
static memory
 dynamic memory
 stack
 heap
 lifetime of objects
 techniques for garbage collection &
storage reclamation

Exceptions
unexpected input
 unexpected divide by zero
 unexpected attempt to create a new
block of space on the heap

Programming
Paradigms
Imperative
 Object-oriented
 Functional
 Logic (declarative) programming
 Event-driven programming
 Concurrent programming

Imperative
Programming

Explicit series of steps
– calculates, retrieves input, produces output

Procedural abstraction
– assignments, loops, sequences, conditionals

Major imperative languages
– Fortran (1954, IBM, John Backus), Cobol
(Codasyl Committee), C (designed for and
implemented on the UNIX operating system on
the DEC PDP-11 by Dennis Ritchie) , C++, Ada
Object-Oriented
Programming



Program is a collection of objects which
pass messages to one another to transform
their states
Object modeling, classification, inheritance
are fundamental building blocks
Major OO languages
– Smalltalk (Xerox PARC - Adele Goldberg & Alan
Kay 1970’s), Java, C++, Eiffel
Functional
Programming

Program is a collection of mathematical
functions
– input (domain)
– result (range)

Functions interact & combine using
– functional composition, conditionals, recursion

Major functional languages
– Lisp (John McCarthy – M.I.T. – late 50’s),
Scheme (block structure, lexical scoping, etc.),
Haskell, ML
Logic (declarative)
Programming
Program is a series of statements
about what should happen rather than
how it should be done
 Expresses non-determinism
 Major logic programming language

– Prolog(Alain Colmerauer – Universite
d’Aix Marseilles – 1972)
Event-driven
Programming
Program is a continuous loop that
responds to unpredictably ordered
events
 Events originate from

– user actions (mouse clicks or keystrokes)
– sensors on a robot

Major event-driven languages include
– Visual Basic, Java
Concurrent
Programming
Program is a collection of cooperating
processes
 Concurrent Programming Languages

– SR, Linda, High Performance Fortran