tailieunhanh - Lecture Programming languages (2/e): Chapter 1 - Tucker, Noonan

Chapter 1 - Overview. The main contents of this chapter include all of the following: Principles, paradigms, special topics, a brief history, on language design (design constraints, outcomes and goals), compilers and virtual machines. | Programming Languages 2nd edition Tucker and Noonan Chapter 1 Overview A good programming language is a conceptual universe for thinking about programming. A. Perlis Contents Principles Paradigms Special Topics A Brief History On Language Design Design Constraints Outcomes and Goals Compilers and Virtual Machines Programming languages have four properties: Syntax Names Types Semantics For any language: Its designers must define these properties Its programmers must master these properties Principles Syntax The syntax of a programming language is a precise description of all its grammatically correct programs. When studying syntax, we ask questions like: What is the grammar for the language? What is the basic vocabulary? How are syntax errors detected? Names Various kinds of entities in a program have names: variables, types, functions, parameters, classes, objects, Named entities are bound in a running program to: Scope Visibility Type Lifetime Types A type is a collection of values and a collection of operations on those values. Simple types numbers, characters, booleans, Structured types Strings, lists, trees, hash tables, A language’s type system can help to: Determine legal operations Detect type errors Semantics The meaning of a program is called its semantics. In studying semantics, we ask questions like: When a program is running, what happens to the values of the variables? What does each statement mean? What underlying model governs run-time behavior, such as function call? How are objects allocated to memory at run-time? A programming paradigm is a pattern of problem-solving thought that underlies a particular genre of programs and languages. There are four main programming paradigms: Imperative Object-oriented Functional Logic (declarative) Paradigms Imperative Paradigm Follows the classic von Neumann-Eckert model: Program and data are indistinguishable in memory Program = a sequence of commands State = . | Programming Languages 2nd edition Tucker and Noonan Chapter 1 Overview A good programming language is a conceptual universe for thinking about programming. A. Perlis Contents Principles Paradigms Special Topics A Brief History On Language Design Design Constraints Outcomes and Goals Compilers and Virtual Machines Programming languages have four properties: Syntax Names Types Semantics For any language: Its designers must define these properties Its programmers must master these properties Principles Syntax The syntax of a programming language is a precise description of all its grammatically correct programs. When studying syntax, we ask questions like: What is the grammar for the language? What is the basic vocabulary? How are syntax errors detected? Names Various kinds of entities in a program have names: variables, types, functions, parameters, classes, objects, Named entities are bound in a running program to: Scope Visibility Type .