1. Trang chủ
  2. » Công Nghệ Thông Tin

programming language concept

66 237 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 66
Dung lượng 548,5 KB

Nội dung

1 1 Programming Language Programming Language Concepts Concepts Tatjana Petkovi Tatjana Petkovi ć ć tatpet@utu.fi tatpet@utu.fi 2 Programming Language Programming Language Pragmatics Pragmatics Michael Scott Michael Scott http://www.cs.rochester.edu/u http://www.cs.rochester.edu/u /scott/pragmatics/ /scott/pragmatics/ 3 Contents Contents 1 Introduction 1 Introduction 2 Programming Language Syntax 2 Programming Language Syntax 2.1 Specifying Syntax 2.1 Specifying Syntax 2.2 Recognizing Syntax 2.2 Recognizing Syntax 2.3* Theoretical Foundations 2.3* Theoretical Foundations 4 3 Names, Scopes, and Bindings 3 Names, Scopes, and Bindings 3.1 The Notion of Binding Time 3.1 The Notion of Binding Time 3.2 Object Lifetime and Storage 3.2 Object Lifetime and Storage Management Management 3.3 Scope Rules 3.3 Scope Rules 3.4 The Binding of Referencing 3.4 The Binding of Referencing Environments Environments 3.5 Overloading and Related Concepts 3.5 Overloading and Related Concepts 3.6 Naming-Related Pitfalls in Language 3.6 Naming-Related Pitfalls in Language Design Design 5 4 Semantic Analysis 4 Semantic Analysis 5 Assembly-Level Computer Architecture 5 Assembly-Level Computer Architecture 6 Control Flow 6 Control Flow 6.1 Expression Evaluation 6.1 Expression Evaluation 6.2 Structured and Unstructured Flow 6.2 Structured and Unstructured Flow 6.3 Sequencing 6.3 Sequencing 6.4 Selection 6.4 Selection 6.5 Iteration 6.5 Iteration 6.6 Recursion 6.6 Recursion 6 7 Data Types 7 Data Types 7.1 Type Systems 7.1 Type Systems 7.2 Type Checking 7.2 Type Checking 7.3 Records (Structures) and Variants 7.3 Records (Structures) and Variants (Unions) (Unions) 7.4 Arrays 7.4 Arrays 7.5 Strings 7.5 Strings 7.6 Sets 7.6 Sets 7.7 Pointers and Recursive Types 7.7 Pointers and Recursive Types 7.8 Lists 7.8 Lists 7 8 Subroutines and Control Abstraction 8 Subroutines and Control Abstraction 8.1 Review of Stack Layout 8.1 Review of Stack Layout 8.2 Calling Sequences 8.2 Calling Sequences 8.3 Parameter Passing 8.3 Parameter Passing 8.4 Generic Subroutines and Modules 8.4 Generic Subroutines and Modules 8.5 Exception Handling 8.5 Exception Handling 8.6 Coroutines 8.6 Coroutines 8 9 9 Building a Runnable Program Building a Runnable Program 10 Data Abstraction and Object 10 Data Abstraction and Object Orientation Orientation 11 Alternative Programming Models: 11 Alternative Programming Models: Functional and Logic Languages Functional and Logic Languages 12 Concurrency 12 Concurrency 13 Code Improvement 13 Code Improvement 9 Introduction Introduction  Computing devices: Computing devices: Mechanical: Mechanical:  Fingers, abacus Fingers, abacus  Blaise Pascal 1642 +- Blaise Pascal 1642 +-  Gottfried Wilhelm von Leibnitz +-*/ Gottfried Wilhelm von Leibnitz +-*/  Charles Babbage 1832 programmable Charles Babbage 1832 programmable Electronical Electronical : : COLOSSUS 1943 COLOSSUS 1943 ENIAC (Electronic Numerical Integrator and Computer) ENIAC (Electronic Numerical Integrator and Computer) 1946 1946 10  Machine language Machine language binary system - John Von Neumann binary system - John Von Neumann GCD for MIPS R4000 GCD for MIPS R4000 [...]...  introduced many important language concepts that are still in use  Fortran 99 array operations 17  Cobol (Common Business Oriented Language)  1959  COBOL commetee (IBM, Honeywell, FlowMatic, )  at some point 60% of all business applications 18  Algol 60 (Algorithmic Language)      the first European language never very present in practice introduced modern concepts big influence on further... object-oriented 25  declarative languages  program = description of the problem  a formal statement of what is the problem  closer to humans than computers  functional languages    Lisp, 1958 λ-calculus, Church 1930 computing without variables  logic programming  predicate logic, Fredge 1871  Prolog, seventies  computing with relations 26 The programming language spectrum 27  sequential... proportion to hardware cost about 450 languages  ADA      1983 new attempt for the universal language US DOD too big expectations never fulfilled theoreticaly significant, data types, moduls, abstraction, concurrency, exception handling 22 C       1970 UNIX, system software programming 1978 D M Ritchi and B W Kernighan 1983 ANSI C close to assembly languages not reliable, weak type checking,... object-oriented languages      data abstraction objects, classes inheritance, polimorphism roots in Simula 67 Smalltalk 80, Eiffel, Omega, Oberon, C++, Delta, Java  visul environment, interactive,  events driven programming: Visual Basic, Delphi 24 Language classification  imperative  how the computer should solve the problem  first do this, then repeat that, then branch there  procedural languages... practically impossible to create large programs 11  Assembly languages assembler GCD 12  Assembler  translator from symbolic language to machine language (one-to-one mapping)  tool to assemble the symbolic program in the machine  Advantages  relocatable & reusable (copy) programs  macro expansion  first step towards higher-level programming  larger programs (like operating systems) possible...  explicite (Java, Ada, Modula-3) 28 Why so many languages?  evolution goto  while, case,  object-oriented  special purposes symbolic data – Lisp character strings – Snobol, Icon low-level programming – C numeric data – Fortran logic programming - Prolog  personal preference iteration : recursion pointers : implicit dereferencing 29 What makes a language successful?  expressive power  ease of... maintenance of larger programs is difficult  Higher-level languages  portability  natural notation (for anything)  support to software development 14  Machine independent languages     Fortran 1956 Cobol 1959 Algol 1958, 1960  compilers 15 16  Fortran (Mathematical Formula Translator)     Backus, 1957 IBM compilation instead of translation language for scientific computing  most important... expressive power  ease of use for a novice Basic, Logo, Pascal, Java,  ease of implementation  excellent compilers Fortran  economics, patronage, inertia Cobol  programming vs implementation conceptual clarity vs implementation efficiency 30 Language characteristics formally defined syntax (grammars, syntax diagrams) data types (predefined, others) data structures (array, record, file, set) control... format data exception handling mechanisms I/O procedures 32 Evaluating languages  readability    more readable less documentation factors: key words modularity degree simplicity num = num + 1 num += 1 ++num num++ 33  readability (still )  orthogonality  small number of concepts and ways to combine them  control flow  structural languages  data structures  records more clear than arrays  syntax... concepts big influence on further development Ada  Basic (Beginers All-purpose Symbolic Instruction Code)  1961  popular in the eighties  Visul Basic, Visual Basic for Application 19  PL/1 (Programming Language One)  general-purpose  meant to replace Fortran, Cobol and Algol  Algol 68  the same idea of universality  too complex  hardware could not support them  Algol 68 compiler never completely . 1 1 Programming Language Programming Language Concepts Concepts Tatjana Petkovi Tatjana Petkovi ć ć tatpet@utu.fi tatpet@utu.fi 2 Programming Language Programming Language Pragmatics Pragmatics Michael. 12  Assembly languages Assembly languages assembler assembler GCD GCD 13  Assembler Assembler  translator from symbolic language to machine translator from symbolic language to machine language. Environments 3.5 Overloading and Related Concepts 3.5 Overloading and Related Concepts 3.6 Naming-Related Pitfalls in Language 3.6 Naming-Related Pitfalls in Language Design Design 5 4 Semantic

Ngày đăng: 24/10/2014, 21:28