Programming language design concepts by david a watt pdf


PROGRAMMING LANGUAGE. DESIGN CONCEPTS. David A. Watt, University of Glasgow with contributions by. William Findlay, University of Glasgow. Programming Language Design Concepts - basu by David A. Watt Kerry_Patterson,_Joseph_Grenny,_Ron_McMillan,_Al_(zlibraryexau2g3p_onion ) This book is a tutorial for the computer programming language C. Unlike BASIC. Programming Language. Design Concepts. David A Watt. July © , D.A. Watt,. University of Glasgow. Page 2. Assumptions. Essential: understanding .

Language:English, Spanish, Arabic
Genre:Personal Growth
Published (Last):09.10.2015
Distribution:Free* [*Registration Required]
Uploaded by: JEANETTE

46150 downloads 151835 Views 26.45MB PDF Size Report

Programming Language Design Concepts By David A Watt Pdf

Explains the concepts underlying programming languages, and demonstrates how these concepts are synthesized in the major paradigms: imperative, OO. Programming Language Design Concepts [David A. Watt] on * FREE* shipping on qualifying offers. Explains the concepts underlying. Programming Language Design Concepts David A. Watt This book explains the concepts underlying programming languages, and demonstrates how these.

Figure P. These languages are studied only impressionistically. It would certainly be valuable for readers to learn to program in all of these languages, in order to gain deeper insight, but this book makes no attempt to teach programming per se. The bibliography contains suggested reading on all of these languages. Exercises Each chapter is followed by a number of relevant exercises. A typical exercise is to analyze some aspect of a favorite language, in the same way that various languages are analyzed in the text. Exercises like this are designed to deepen readers understanding of languages that they already know, and to reinforce understanding of particular concepts by studying how they are supported by different languages. A typical project is to design some extension or modication to an existing language. I should emphasize that language design should not be undertaken lightly! These projects are aimed particularly at the most ambitious readers, but all readers would benet by at least thinking about the issues raised. Readership All programmers, not just language specialists, need a thorough understanding of language concepts. This is because programming languages are our most fundamental tools.

Lambda Jam , Melbourne, 13—15 May. Keynote Melbourne University. Lecture series, Padova, 27—31 May BuzzConf , Buenos Aires, 12—14 June Keynote speaker. Program committee. Program co-chair. Research interests Concurrency. A recent result shows how to extend the Curry-Howard correspondence to session types. A paper describing the book appeared in SBMF , and won the prize for best paper.

On the other hand, programming linguists can not only analyze existing programming languages; they can also design and specify new programming languages, and they can implement these languages on computers. Programming linguistics therefore has several aspects, which we discuss briey in the following subsections.

A programming language, to be worthy of the name, must satisfy certain fundamental requirements. That is to say, every problem must have a solution that can be programmed in the language, if that problem can be solved at all by a computer. This might seem to be a very strong requirement, but even a very small programming language can meet it. Any language in which we can dene recursive functions is universal.

On the other hand, a language with neither recursion nor iteration cannot be universal. Certain application languages are not universal, but we do not generally classify them as programming languages. A programming language should also be reasonably natural for solving problems, at least problems within its intended application area. For example, a programming language whose only data types are numbers and arrays might be natural for solving numerical problems, but would be less natural for solving problems in commerce or articial intelligence.

Conversely, a programming language whose only data types are strings and lists would be an unnatural choice for solving numerical problems. A programming language must also be implementable on a computer. That is to say, it must be possible to execute every well-formed program in the language. Mathematical notation in its full generality is not implementable, because in this notation it is possible to formulate problems that cannot be solved by any computer.

Natural languages also are not implementable, because they are imprecise and ambiguous.

Haskell in education - HaskellWiki

Therefore, mathematical notation and natural languages, for entirely different reasons, cannot be classied as programming languages. In practice, a programming language should be capable of an acceptably efcient implementation. There is plenty of room for debate over what is acceptably efcient, especially as the efciency of a programming language implementation is strongly inuenced by the computer architecture.

PROLOG programmers have to accept an order of magnitude lower efciency, but would justify this on the grounds that the language is far more natural within its own application area; besides, they hope that new computer architectures will eventually appear that are more suited for executing PROLOG programs than conventional architectures. In Parts II and III of this book we shall study the concepts that underlie the design of programming languages: data and types, variables and storage, bindings and scope, procedural abstraction, data abstraction, generic abstraction, type systems, control, and concurrency.

Although few of us will ever design a programming language which is extremely difcult to do well , as programmers we can all benet by studying these concepts. Programming languages are our most basic tools, and we must thoroughly master them to use them effectively. Whenever we have to learn a new programming language and discover how it can be effectively exploited to construct reliable and maintainable programs, and whenever we have to decide which programming language is most suitable for solving a given problem, we nd that a good understanding of programming language concepts is indispensable.

We can master a new programming language most effectively if we understand the underlying concepts that it shares with other programming languages. Different selections of key concepts support radically different styles of programming, which are called paradigms. There are six major paradigms.

Imperative programming is characterized by the use of variables, commands, and procedures; object-oriented programming by the use of objects, classes, and inheritance; concurrent programming by the use of concurrent processes, and various control abstractions; functional programming by the use of functions; logic programming by the use of relations; and scripting languages by the presence of very high-level features.

We shall study all of these paradigms in Part IV of this book. We have seen that natural languages also have syntax and semantics, but pragmatics is unique to programming languages. A programming languages syntax is concerned with the form of programs: how expressions, commands, declarations, and other constructs must be arranged to make a well-formed program.

A programming languages semantics is concerned with the meaning of programs: how a well-formed program may be expected to behave when executed on a computer. A programming languages pragmatics is concerned with the way in which the language is intended to be used in practice. Syntax inuences how programs are written by the programmer, read by other programmers, and parsed by the computer.

Semantics determines how programs are composed by the programmer, understood by other programmers, and interpreted by the computer. Pragmatics inuences how programmers are expected to design and implement programs in practice. Syntax is important, but semantics and pragmatics are more important still. To underline this point, consider how an expert programmer thinks, given a programming problem to solve.

Firstly, the programmer decomposes the problem, identifying suitable program units procedures, packages, abstract types, or classes. Secondly, the programmer conceives a suitable implementation of each program unit, deploying language concepts such as types, control structures, exceptions, and so on.

Lastly, the programmer codes each program unit. Only at this last stage does the programming languages syntax become relevant. In this book we shall pay most attention to semantic and pragmatic issues. A given construct might be provided in several programming languages, with variations in syntax that are essentially supercial.

Semantic issues are more important. We need to appreciate subtle differences in meaning between apparently similar constructs. We need to see whether a given programming language confuses distinct concepts, or supports an important concept inadequately, or fails to support it at all.

In this book we study those concepts that are so important that they are supported by a variety of programming languages. C is now middle-aged, and its design defects are numerous; however, it is very widely known and used, and even its defects are instructive.

ADA is a programming language that supports imperative, object-oriented, and concurrent programming. None of these programming languages is by any means perfect. The ideal programming language has not yet been designed, and is never likely to be!

Programming Language Design Concepts - David Watt (2004)

High-level languages are implemented by compiling programs into machine language, by interpreting them directly, or by some combination of compilation and interpretation. Any system for processing programs executing programs, or preparing them for execution is called a language processor.

Language processors include compilers, interpreters, and auxiliary tools like source-code editors and debuggers.

We have seen that a programming language must be implementable. However, this does not mean that programmers need to know in detail how a programming language is implemented in order to understand it thoroughly. Accordingly, implementation issues will receive limited attention in this book, except for a short section Implementation notes at the end of each chapter.

Numerous concepts have been invented, tested, and improved by being incorporated in successive programming languages. With very few exceptions, the design of each programming language has been strongly inuenced by experience with earlier languages. The following brief historical survey summarizes the ancestry of the major programming languages and sketches the development of the concepts introduced in this book.

It also reminds us that todays programming languages are not the end product of developments in programming language design; exciting new concepts, languages, and paradigms are still being developed, and the programming language scene ten years from now will probably be rather different from todays. Figure 1. This is not the place for a comprehensive survey, so only the major programming languages are mentioned.

It introduced symbolic expressions and arrays, and also procedures subroutines with parameters. In other respects FORTRAN in its original form was fairly low-level; for example, control ow was largely effected by conditional and unconditional jumps.

COBOL was another early major high-level language. Its most important contribution was the concept of data descriptions, a forerunner of todays data types. ALGOL60 was the rst major programming language to be designed for communicating algorithms, not just for programming a computer. ALGOL60 introduced the concept of block structure, whereby variables and procedures could be declared wherever in the program they were needed. It was also the rst major programming language to support recursive procedures.

On Chapter 1 Programming languages top of these it introduced many new features, including low-level forms of exceptions and concurrency.

The resulting language was huge, complex, incoherent, and difcult to implement. A better way to gain expressive power is to choose an adequate set of concepts and allow them to be combined systematically. For instance, starting with concepts such as integers, arrays, and procedures, the ALGOL68 programmer can declare an array of integers, an array of arrays, or an array of procedures; likewise, the programmer can dene a procedure whose parameter or result is an integer, an array, or another procedure.

It is simple, systematic, and efciently implementable. PASCAL and ALGOL68 were among the rst major programming languages with both a rich variety of control structures conditional and iterative commands and a rich variety of data types such as arrays, records, and recursive types. C was originally designed to be the system programming language of the UNIX operating system. C is suitable for writing both low-level code such as the UNIX system kernel and higher-level applications.

However, its low-level features are easily misused, resulting in code that is unportable and unmaintainable. PASCALs powerful successor, ADA, introduced packages and generic units designed to aid the construction of large modular programs as well as high-level forms of exceptions and concurrency.

Such a stated ambition is perhaps very rash, and ADA also attracted a lot of criticism. The critics were wrong: ADA was very well designed, is particularly suitable for developing high-quality reliable, robust, maintainable, efcient software, and is the language of choice for mission-critical applications in elds such as aerospace. We can discern certain trends in the history of programming languages. One has been a trend towards higher levels of abstraction. The mnemonics and symbolic labels of assembly languages abstract away from operation codes and machine addresses.

Variables and assignment abstract away from inspection and updating of storage locations. Data types abstract away from storage structures. Control structures abstract away from jumps. Procedures abstract away from subroutines. Packages achieve encapsulation, and thus improve modularity. Generic units abstract procedures and packages away from the types of data on which they operate, and thus improve reusability. Another trend has been a proliferation of paradigms.

Nearly all the languages mentioned so far have supported imperative programming, which is characterized by the use of commands and procedures that update variables. However, other paradigms have also become popular and important.

An object has variable components and is equipped with certain operations. Only these operations can access the objects variable components. A class is a family of objects with similar variable components and operations. Classes turn out to be convenient reusable program units, and all the major object-oriented languages are equipped with rich class libraries. Nevertheless, its design is clumsy; it inherited all Cs shortcomings, and it added some more of its own.

Although primarily a simple object-oriented language, JAVA can also be used for distributed and concurrent programming. JAVA is well suited for writing applets small portable application programs embedded in Web pages , as a consequence of a highly portable implementation the Java Virtual Machine that has been incorporated into all the major Web browsers.

Programming Language Design Concepts

Thus JAVA has enjoyed a symbiotic relationship with the Web, and both have experienced enormous growth in popularity. C is very similar to JAVA, apart from some relatively minor design improvements, but its more efcient implementation makes it more suitable for ordinary application programming. Functional programming is based on functions over types such as lists and trees.

The ancestral functional language was LISP, which demonstrated at a remarkably early date that signicant programs can be written without resorting to variables and assignment.

They treat functions as ordinary values, which can be passed as parameters and returned as results from other functions. Moreover, they incorporate advanced type systems, allowing us to write polymorphic functions functions that operate on data of a variety of types. As noted in Section 1. Nevertheless, many programming language designers have sought to exploit subsets of mathematical notation in programming languages.

Logic programming is based on a subset of predicate logic. Logic programs infer relationships between values, as opposed to computing output values from input values. In its pure logical form, however, PROLOG is rather weak and inefcient, so it has been extended with extra-logical features to make it more usable as a programming language. Programming languages are intended for writing application programs and systems programs. However, there are other niches in the ecology of computing.

An operating system such as UNIX provides a language in which a user or system administrator can issue commands from the keyboard, or store a command 10 Chapter 1 Programming languages script that will later be called whenever required. The Internet has created a variety of new niches for scripting. For example, the results of a database query might be converted to a dynamic Web page by a script, typically written in PERL. All these applications are examples of scripting.

Scripts programs written in scripting languages typically are short and high-level, are developed very quickly, and are used to glue together subsystems written in other languages. So scripting languages, while having much in common with imperative programming languages, have different design constraints. Summary In this introductory chapter: We have seen what is meant by programming linguistics, and the topics encompassed by this term: concepts and paradigms; syntax, semantics, and pragmatics; and language processors.

Related articles:

Copyright © 2019
DMCA |Contact Us