Download presentation
Presentation is loading. Please wait.
Published byMarshall Black Modified over 9 years ago
2
What Makes a Good Language? Lecture 3
3
The first formal languages n The evolution of writing systems to record language reveals the first steps toward formal notation and unambiguous communication. n The world’s oldest written documents are in Sumerian - small 3 dimensional tokens used for counting things like grain, wine and cattle n At first writing was composed of individual pictographs
4
The first formal languages n Gradually civilization moved to ideographs, symbols for ideas n meaning understood by convention, not by the picture n earliest known algorithms are due to Babylonians - a base 60 notation for arithmetic, including fractions
5
Designs of High-level Computer Languages n Mechanisms to design still must be perfected n every known language has its shortcomings n usually the more popular languages have less shortcomings
6
Popularity n some reasons for success or failure of language may be external : n a government mandate (COBOL or Ada) n strong computer manufacturer support (FORTRAN) n excellent text (Griswold’s SNOBOL4 text) n use as theoretical study (Pascal and LISP)
7
Attributes of a Good Language n Clarity, simplicity, and unity n language provides both a conceptual framework for thinking about algorithms and a way of expressing n aid the programmer before coding n unified set of primitives used in developing algorithms n conceptual integrity - minimum number of different concepts and rules for combining to be as simple and regular as possible n FORTRAN had 3 but not higher dimensional arrays
8
Syntax n Affects the ease with which a program may be written, tested and later understood and modified (readability) n 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] n How many ways can you write in C to add to a variable x? or = as ==
9
Famous FORTRAN example n Do 10 I = 1.5 n a(I) = X + B(I) n 10 continue n FORTRAN ignores all spaces n so this was interpreted to n do10i = 1.5 n destroyed a rocket!
10
Hamming code n Provides the greatest distance between representations n catch errors easily n each representation is at least separated by two distinct places n Notice the syntax of the Do was “too” close to the syntax of the assignment.
11
Orthogonality n Able to combine various features of a language in all possible combination and still make sense. n Expressions and conditionals are orthogonal if any expression can be used within the conditional statement n this make a language easier to learn (fewer exceptions and special cases) n also program will compile without errors even if it contains a combination that does not make sense u this is why orthogonality is controversial
12
Naturalness for the application n Program structure reflects the underlying logical structure n provide appropriate data structures, operations and control structures
13
Support for abstraction n The jump made from the abstract data structures to the solution built with the language data structures and operations n class scheduling - need the structures of student, class section, instructor, lecture room - need the operation of assign student to a class section n what support is provided? n Programmer should use language self-contained abstractions without knowing details of implementation n It is desirable to have constructs that factor out recurring patterns, e.g., subprograms
14
Ease of program verification n Reliability is a central concern n verification - a program correctly performs its required function n proven correct by a formal verification method n informally by desk checking n tested with test input data and results checked against specifications
15
Programming environment n Presence of an appropriate programming environment may make a technically weak language easier to work with n special editors, testing packages n facilities for maintaining, modifying multiple versions
16
Portability of programs n Transportability - independent of the features of a particular machine n standardized definitions u Ada, FORTRAN, C all have standardized definitions u ML come from single source implementation allowing the language designer some control over portable features of the language
17
Cost of use n Program execution - optimizing compilers, efficient register allocation, efficient run-time support u important in large production programs that will be executed repeatedly n Cost of program translation - compiled many times n Cost of program creation, testing, and use - a inefficient language may take less programmer time (Smalltalk)
18
Cost of use n Cost of program maintenance - greatest amount of dollars spent
19
Language Standardization n What describes a programming language? n int i; i = (1&& 2 ) + 3; n Is this valid C? What is the the value of i? n How would you answer this? u Read the definition in the language reference manual to decide what the statement means. u Or Write the program on your local computer system to see what happens u or read the definition in the language standard
20
Language Standardization n The first and second option are tied to a particular implementation. Is that implementation correct? n Often, language design involves some intricate details and one vendor may have a different interpretation from another, yielding a slightly different execution behavior. n What about “additional” features
21
Standards n Proprietary Standards n Consensus Standards n In the US, the American National Standards Institute, ANSI u programming language standards are assigned to committee X3 of the Computer Business Equipment Manufactures, or CBEMA n partially technical and partially political n consensus process
22
The FORTRAN 77 string problem n Strings and substrings were desirable features n most implementations already had such features n several feasible implementations of substrings u 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] u no consensus, left out (expedient)
23
Standards n Timeliness. u When do we standardize a language? n Conformance. u What does it mean for a program to adhere to a standard and for a compiler to compile to a standard? n Obsolescence. u When does a standard age and how does it get modified
24
Timeliness n FORTRAN was standardize in 1966 when there many incompatible versions n Ada was standardize before any implementations n balance n LISP - no standard reference (Scheme, Common LISP, IBCL) all exist are similar, but incompatible
25
Conformance n A program is conformant if it only uses features defined in the standard n A conforming compiler is one which when given a conformant program, produces an executable program that produces the correct output n However, extensions can be added and programs can use those extensions.
26
Obsolescence n Standards have to be reviewed every five years and either be renewed or dropped n most standards require backward compatibility n A feature is obsolescent if it is a candidate feature that may be dropped in the next version of the standards u 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
27
Obsolescence n A deprecated feature may become obsolescent with the next standard, hence may be dropped after two revisions u gives a 10-20 year warning. n New programs should not use either class of features.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.