+ All Categories
Home > Documents > What Makes a Good Language? Lecture 3 The first formal languages n The evolution of writing systems...

What Makes a Good Language? Lecture 3 The first formal languages n The evolution of writing systems...

Date post: 17-Jan-2016
Category:
Upload: marshall-black
View: 213 times
Download: 1 times
Share this document with a friend
26
What Makes a Good Language? Lecture 3
Transcript
Page 1: What Makes a Good Language? Lecture 3 The first formal languages n The evolution of writing systems to record language reveals the first steps toward.

What Makes a Good Language?

Lecture 3

Page 2: What Makes a Good Language? Lecture 3 The first formal languages n The evolution of writing systems to record language reveals the first steps toward.

The first formal languages

The evolution of writing systems to record language reveals the first steps toward formal notation and unambiguous communication.

The world’s oldest written documents are in Sumerian - small 3 dimensional tokens used for counting things like grain, wine and cattle

At first writing was composed of individual pictographs

Page 3: What Makes a Good Language? Lecture 3 The first formal languages n The evolution of writing systems to record language reveals the first steps toward.

The first formal languages

Gradually civilization moved to ideographs, symbols for ideas

meaning understood by convention, not by the picture

earliest known algorithms are due to Babylonians - a base 60 notation for arithmetic, including fractions

Page 4: What Makes a Good Language? Lecture 3 The first formal languages n The evolution of writing systems to record language reveals the first steps toward.

Designs of High-level Computer Languages Mechanisms to design still must be perfected every known language has its shortcomings usually the more popular languages have

less shortcomings

Page 5: What Makes a Good Language? Lecture 3 The first formal languages n The evolution of writing systems to record language reveals the first steps toward.

Popularity

some reasons for success or failure of language may be external :

a government mandate (COBOL or Ada) strong computer manufacturer support

(FORTRAN) excellent text (Griswold’s SNOBOL4 text) use as theoretical study (Pascal and LISP)

Page 6: What Makes a Good Language? Lecture 3 The first formal languages n The evolution of writing systems to record language reveals the first steps toward.

Attributes of a Good Language

Clarity, simplicity, and unity language provides both a conceptual framework for

thinking about algorithms and a way of expressing aid the programmer before coding unified set of primitives used in developing algorithms conceptual integrity - minimum number of different

concepts and rules for combining to be as simple and regular as possible

FORTRAN had 3 but not higher dimensional arrays

Page 7: What Makes a Good Language? Lecture 3 The first formal languages n The evolution of writing systems to record language reveals the first steps toward.

Syntax Affects the ease with which a program may be

written, tested and later understood and modified (readability)

many languages contain syntactic constructs that look identical put are radically different. Example, SNOBOL, a presence of a blank char, which is an operator, in a statement may entirely alter its meaning. Or a(1) versus a[1]

How many ways can you write in C to add to a variable x? or = as ==

Page 8: What Makes a Good Language? Lecture 3 The first formal languages n The evolution of writing systems to record language reveals the first steps toward.

Famous FORTRAN example

Do 10 I = 1.5 a(I) = X + B(I) 10 continue FORTRAN ignores all spaces so this was interpreted to do10i = 1.5 destroyed a rocket!

Page 9: What Makes a Good Language? Lecture 3 The first formal languages n The evolution of writing systems to record language reveals the first steps toward.

Hamming code

Provides the greatest distance between representations

catch errors easily each representation is at least separated by

two distinct places Notice the syntax of the Do was “too” close

to the syntax of the assignment.

Page 10: What Makes a Good Language? Lecture 3 The first formal languages n The evolution of writing systems to record language reveals the first steps toward.

Orthogonality

Able to combine various features of a language in all possible combination and still make sense.

Expressions and conditionals are orthogonal if any expression can be used within the conditional statement

this make a language easier to learn (fewer exceptions and special cases)

also program will compile without errors even if it contains a combination that does not make sense this is why orthogonality is controversial

Page 11: What Makes a Good Language? Lecture 3 The first formal languages n The evolution of writing systems to record language reveals the first steps toward.

Naturalness for the application

Program structure reflects the underlying logical structure

provide appropriate data structures, operations and control structures

Page 12: What Makes a Good Language? Lecture 3 The first formal languages n The evolution of writing systems to record language reveals the first steps toward.

Support for abstraction The jump made from the abstract data structures to the

solution built with the language data structures and operations

class scheduling - need the structures of student, class section, instructor, lecture room - need the operation of assign student to a class section

what support is provided? Programmer should use language self-contained

abstractions without knowing details of implementation It is desirable to have constructs that factor out recurring

patterns, e.g., subprograms

Page 13: What Makes a Good Language? Lecture 3 The first formal languages n The evolution of writing systems to record language reveals the first steps toward.

Ease of program verification

Reliability is a central concern verification - a program correctly performs its

required function proven correct by a formal verification

method informally by desk checking tested with test input data and results

checked against specifications

Page 14: What Makes a Good Language? Lecture 3 The first formal languages n The evolution of writing systems to record language reveals the first steps toward.

Programming environment

Presence of an appropriate programming environment may make a technically weak language easier to work with

special editors, testing packages facilities for maintaining, modifying multiple

versions

Page 15: What Makes a Good Language? Lecture 3 The first formal languages n The evolution of writing systems to record language reveals the first steps toward.

Portability of programs

Transportability - independent of the features of a particular machine

standardized definitions Ada, FORTRAN, C all have standardized

definitions ML come from single source implementation

allowing the language designer some control over portable features of the language

Page 16: What Makes a Good Language? Lecture 3 The first formal languages n The evolution of writing systems to record language reveals the first steps toward.

Cost of use Program execution - optimizing compilers, efficient

register allocation, efficient run-time support important in large production programs that will be

executed repeatedly Cost of program translation - compiled many times Cost of program creation, testing, and use - a

inefficient language may take less programmer time (Smalltalk)

Page 17: What Makes a Good Language? Lecture 3 The first formal languages n The evolution of writing systems to record language reveals the first steps toward.

Cost of use

Cost of program maintenance - greatest amount of dollars spent

Page 18: What Makes a Good Language? Lecture 3 The first formal languages n The evolution of writing systems to record language reveals the first steps toward.

Language Standardization

What describes a programming language? int i; i = (1&& 2 ) + 3; Is this valid C? What is the the value of i? How would you answer this?

Read the definition in the language reference manual to decide what the statement means.

Or Write the program on your local computer system to see what happens

or read the definition in the language standard

Page 19: What Makes a Good Language? Lecture 3 The first formal languages n The evolution of writing systems to record language reveals the first steps toward.

Language Standardization

The first and second option are tied to a particular implementation. Is that implementation correct?

Often, language design involves some intricate details and one vendor may have a different interpretation from another, yielding a slightly different execution behavior.

What about “additional” features

Page 20: What Makes a Good Language? Lecture 3 The first formal languages n The evolution of writing systems to record language reveals the first steps toward.

Standards

Proprietary Standards Consensus Standards In the US, the American National Standards

Institute, ANSI programming language standards are assigned to

committee X3 of the Computer Business Equipment Manufactures, or CBEMA

partially technical and partially political consensus process

Page 21: What Makes a Good Language? Lecture 3 The first formal languages n The evolution of writing systems to record language reveals the first steps toward.

The FORTRAN 77 string problem Strings and substrings were desirable features most implementations already had such features several feasible implementations of substrings

if M = “abcdefg” then “bcde” could be M[2:5] or M[2:4] (start at 2 and go 4 chars) or start at the right M[3:6]

no consensus, left out (expedient)

Page 22: What Makes a Good Language? Lecture 3 The first formal languages n The evolution of writing systems to record language reveals the first steps toward.

Standards

Timeliness. When do we standardize a language?

Conformance. What does it mean for a program to adhere to a

standard and for a compiler to compile to a standard?

Obsolescence. When does a standard age and how does it get

modified

Page 23: What Makes a Good Language? Lecture 3 The first formal languages n The evolution of writing systems to record language reveals the first steps toward.

Timeliness

FORTRAN was standardize in 1966 when there many incompatible versions

Ada was standardize before any implementations

balance LISP - no standard reference (Scheme,

Common LISP, IBCL) all exist are similar, but incompatible

Page 24: What Makes a Good Language? Lecture 3 The first formal languages n The evolution of writing systems to record language reveals the first steps toward.

Conformance

A program is conformant if it only uses features defined in the standard

A conforming compiler is one which when given a conformant program, produces an executable program that produces the correct output

However, extensions can be added and programs can use those extensions.

Page 25: What Makes a Good Language? Lecture 3 The first formal languages n The evolution of writing systems to record language reveals the first steps toward.

Obsolescence

Standards have to be reviewed every five years and either be renewed or dropped

most standards require backward compatibility A feature is obsolescent if it is a candidate

feature that may be dropped in the next version of the standards warns users that the feature is still available, but in

the next 5 to 10 years will be dropped. Fair warning to rewrite code using that feature

Page 26: What Makes a Good Language? Lecture 3 The first formal languages n The evolution of writing systems to record language reveals the first steps toward.

Obsolescence

A deprecated feature may become obsolescent with the next standard, hence may be dropped after two revisions gives a 10-20 year warning.

New programs should not use either class of features.


Recommended