Sei sulla pagina 1di 18

IS C342

Structure of Programming
Languages

01/08/2007

Sundar B., BITS, Pilani. IS C342

Todays Agenda
Course Perspectives
Computing vs. Programming
Programs
Programming Languages

Course Scope
Coverage
Modules

01/08/2007

Sundar B., BITS, Pilani. IS C342

Course Perspectives
Computing vs. Programming
Programs capture high level computational
behavior. (in contrast with a circuit)
Programming therefore is an activity that
deals with high level computational abstractions

01/08/2007

Sundar B., BITS, Pilani. IS C342

Course Perspectives [2]


Computers vs. Programs
They have independent existence.
Algorithms since Euclid (??? B.C.)
Differences between an algorithm and a program
Programs pre-date (at least digital) computers
Churchs lambda calculus (1930s)

01/08/2007

Sundar B., BITS, Pilani. IS C342

Programs

[Course Perspectives]

What is a program? [Recall analogy from


CP2]
Compare: Plan, Recipe, and Program.
Plan:
e.g. New Year Plans (stop postponing things,
reduce TV time)
e.g. Five Year Plans (generate 10 million jobs,
increase tax revenue)
Question: How is the plan implemented?

01/08/2007

Sundar B., BITS, Pilani. IS C342

Programs [2]

[Course Perspectives]

Recipe:
E.g. Bisibela Bath: 1 cup rice, cup dhal,
1 tablespoon sambar powder, 1 teaspoon chilli
powder; mix everything and add salt to taste;
boil until the mixture is soft.
Question: teaspoon vs. tablespoon? Whose taste?
How soft?
Question: What will be the result?

01/08/2007

Sundar B., BITS, Pilani. IS C342

Programs [3]

[Course Perspectives]

Plans are not (necessarily) feasible:


execution is arbitrary.
Recipes are (often) feasible, but (as often)
are ambiguous
do not have predictable results
are not (necessarily) repeatable: across time or
persons.

01/08/2007

Sundar B., BITS, Pilani. IS C342

Programs [4]

[Course Perspectives]

Programs are specifications of solutions to


problems. They
are unambiguous.
are formal (i.e., they are or should be
constructed systematically out of basic steps)
are executable (by a machine or even by a
human brain within limited scale)
have predictable and repeatable results.

01/08/2007

Sundar B., BITS, Pilani. IS C342

Programs [5]

[Course Perspectives]

Definition: A program is a formal,


unambiguous, and executable
specification of a solution to a problem.

01/08/2007

Sundar B., BITS, Pilani. IS C342

Programs [6]

[Course Perspectives]

Observations:
executable by machine requires formal and
unambiguous.
formal and unambiguous implies repeatable
and predictable. (Ignore Schrodingers cat!)
Question: Does formal and unambiguous imply
executable by machine?

01/08/2007

Sundar B., BITS, Pilani. IS C342

10

Programs [7]

[Course Perspectives]

Not so obvious but yes formal and


unambiguous does imply executable by
machine - under (reasonable) assumptions:
basic steps are realizable in finite time using
finite space.
This assumption is often referred to as Turingcomputable (I.e. executable by a Turing machine).

01/08/2007

Sundar B., BITS, Pilani. IS C342

11

Programs [8]

[Course Perspectives]

Alternative (equivalent) definitions of a


Program:
A formal and unambiguous specification of a
solution to a problem.
An executable specification of a solution to a
problem.

This course will often use these definitions


interchangeably:
It is a matter of perspective!

01/08/2007

Sundar B., BITS, Pilani. IS C342

12

Programming Languages

[Course Perspectives]

Programs are formal specifications


Programming languages provide the
building blocks and the glues to construct
those specifications.
Size(s) of the building blocks and the nature
of the glues vary from language to language.
But the (usual) goal is Turing
computability.
The unusual languages are often domain-specific
(e.g. SQL, JSP/ASP, MS Excel)
01/08/2007

Sundar B., BITS, Pilani. IS C342

13

Prog. Languages [2]

[Course Perspectives]

Church Turing Hypothesis:


Anything computable is Turing-computable

Turing Machine (TM) characteristics:


States (control memory)
State Transitions (instruction execution)
Read/Write (Input/Output)
Left/Right (Sequential Access)

01/08/2007

Sundar B., BITS, Pilani. IS C342

14

Prog. Languages [3]

[Course Perspectives]

Random Access Machine (RAM) is equivalent


to TM:
Random access can be simulated by a
counting/address tape
Instruction execution is nothing but state
transition

So, by Church-Turing hypothesis


Anything computable is RAM-computable

01/08/2007

Sundar B., BITS, Pilani. IS C342

15

Prog. Languages [4]

[Course Perspectives]

Instruction Set Architecture (say for x86) is


an abstract form of RAM
So, by Church-Turing hypothesis
Anything computable is ISA-computable

A programming language (say C) is just an


abstract form of ISA:
Loops/conditionals can be simulated using jumps.
All data values can be converted into binary
forms.

So, by Church-Turing hypothesis


Anything computable is C-computable
01/08/2007

Sundar B., BITS, Pilani. IS C342

16

Prog. Languages [5]

[Course Perspectives]

There is more to languages (than building


blocks and glues):
The building blocks and glues have (often deep)
conceptual foundations
They are not (at least ought not to be) kitchen
sinks they have an internal structure by
themselves.
The product(s) that are made out of them are
live (assuming programs do run!)

01/08/2007

Sundar B., BITS, Pilani. IS C342

17

Course Scope
Course coverage will include
Brief insights into Programming Language
Paradigms - or styles of programming
Select Features of (widely used) languages and
their theoretical Foundations
Implementation of features (Compilers)

01/08/2007

Sundar B., BITS, Pilani. IS C342

18

Potrebbero piacerti anche