0 Bewertungen0% fanden dieses Dokument nützlich (0 Abstimmungen)
89 Ansichten20 Seiten
This document introduces concepts of programming languages. It outlines the topics to be covered, including reasons to study programming languages, language evaluation criteria, language design influences, implementation methods, and related programs. The lecturer is identified and assessment criteria are provided. Objectives include describing language elements, explaining language mechanisms, and implementing an interpreter or compiler for a simple language.
This document introduces concepts of programming languages. It outlines the topics to be covered, including reasons to study programming languages, language evaluation criteria, language design influences, implementation methods, and related programs. The lecturer is identified and assessment criteria are provided. Objectives include describing language elements, explaining language mechanisms, and implementing an interpreter or compiler for a simple language.
This document introduces concepts of programming languages. It outlines the topics to be covered, including reasons to study programming languages, language evaluation criteria, language design influences, implementation methods, and related programs. The lecturer is identified and assessment criteria are provided. Objectives include describing language elements, explaining language mechanisms, and implementing an interpreter or compiler for a simple language.
HCMC University of Technology, Viet Nam 06, 2014 PhD. Nguyen Hua Phung Introduction 1 / 26 Outline 1 Introduction 2 Reasons to study Concepts of Programming Languages 3 Language Evaluation Criteria 4 Language Design 5 Implementation Methods PhD. Nguyen Hua Phung Introduction 2 / 26 Lecturer In Charge My name: Nguyen Hua Phung Email: phung@cse.hcmut.edu.vn Website: http://cse.hcmut.edu.vn/~phung(pending) Ofce hour: 9:00-11:30 Tuesday (subject to change) Sakai: https://elearning.hcmut.edu.vn PhD. Nguyen Hua Phung Introduction 4 / 26 References Programming Languages: Principles And Paradigms, Maurizio Gabbrielli and Simone Martini, Springer, 2006. Programming Languages: Principles and Practices, Kenneth C. Louden, Thomson Brooks/Cole, 2003. Ngon Ngu Lap Trinh: Cac nguyen ly va mo hinh, Cao Hoang Tru, 2004. PhD. Nguyen Hua Phung Introduction 5 / 26 Assessment Tutorial/Lab/Online: 10% Assignment: 20% Midterm: 20% Final:50% PhD. Nguyen Hua Phung Introduction 6 / 26 Objectives After complete this subject, students are able to: describe formally lexicon and grammar of a programming language describe and explain some mechanism of a programming language implement a interpreter/compiler for a simple programming language PhD. Nguyen Hua Phung Introduction 8 / 26 Benets of Studying Increased capacity to express idea Improved background for choosing appropriate languages Increased ability to learn new languages Better understanding of the signicance of implementation Better use of languages that are already known Overall advancement of computing PhD. Nguyen Hua Phung Introduction 9 / 26 Programming Domains Scientic Applications Fortran, ALGOL 60 Business Applications COBOL Articial Intelligence LISP, Prolog Systems Programming PL/S, BLISS, Extended ALGOL, and C Web Software XHTML, JavaScript, PHP PhD. Nguyen Hua Phung Introduction 11 / 26 Language Characteristics Simplicity Orthogonality Support of abstraction (Control, Data) Safety ... PhD. Nguyen Hua Phung Introduction 12 / 26 Evaluation Readability Writability Reliability Cost PhD. Nguyen Hua Phung Introduction 13 / 26 Inuences on Language Design Computer Architecture Von Neumann Programming Methodologies Imperative Machine-based Procedural Declarative Logic Functional Constraint Query-based Object-Oriented ... PhD. Nguyen Hua Phung Introduction 15 / 26 Computer Architecture Inuence Well-known computer architecture: Von Neumann Imperative languages, most dominant, because of von Neumann computers Data and programs stored in memory Memory is separate from CPU Instructions and data are piped from memory to CPU Basis for imperative languages Variables model memory cells Assignment statements model writing to memory cell Iteration is efcient PhD. Nguyen Hua Phung Introduction 16 / 26 Programming Methodologies Inuences 1950s and early 1960s: Simple applications; worry about machine efciency Late 1960s: Efciency became important; readability, better control structures Structured programming Top-down design and step-wise renement Late 1970s: Process-oriented to data-oriented data abstraction Middle 1980s: Object-oriented programming Data abstraction + inheritance + polymorphism PhD. Nguyen Hua Phung Introduction 17 / 26 Language Paradigms Imperative (C, Pascal) Central features are variables, assignment statements, and iteration Functional (LISP, Scheme, Haskel, Ocaml, Scala) Main means of making computations is by applying functions to given parameters Logic (Prolog) Rule-based (rules are specied in no particular order) Object-oriented (Java, C++, Scala) Data abstraction, inheritance, late binding Markup (XHTML, XML) New; not a programming per se, but used to specify the layout of information in Web documents PhD. Nguyen Hua Phung Introduction 18 / 26 Language Design Trade-Offs Reliability vs. cost of execution Conicting criteria Example: Java demands all references to array elements be checked for proper indexing but that leads to increased execution costs Readability vs. writability Another conicting criteria Example: APL provides many powerful operators (and a large number of new symbols), allowing complex computations to be written in a compact program but at the cost of poor readability Writability (exibility) vs. reliability Another conicting criteria Example: C++ pointers are powerful and very exible but not reliably used PhD. Nguyen Hua Phung Introduction 19 / 26 Implementation Methods Compilation Programs are entirely translated into machine language and then executed Pure Interpretation Programs are translated and executed line-by-line Hybrid Implementation Systems A compromise between compilers and pure interpreters Just-in-time Compiler A compiler inside an interpreter compiles just hot methods PhD. Nguyen Hua Phung Introduction 21 / 26 Implementation Methods Compiler Source Execution Data Result Interpreter Source Data Result Compiler Source Interpreter Data Result PhD. Nguyen Hua Phung Introduction 22 / 26 Compilation Phases source program lexical analyzer syntax analyzer semantic analyzer intermediate code generator code optimizer code generator target program front end back end PhD. Nguyen Hua Phung Introduction 24 / 26 Related Programs Preprocessor Assembler Linker Loader Debugger Editor PhD. Nguyen Hua Phung Introduction 25 / 26 Summary What are still in your mind? PhD. Nguyen Hua Phung Introduction 26 / 26