1. Trang chủ
  2. » Giáo án - Bài giảng

nguyên lý ngôn ngữ lập trình nguyễn hứa phùng introduction sinhvienzone com

20 116 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 20
Dung lượng 84,52 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

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

Trang 1

Dr Nguyen Hua Phung

HCMC University of Technology, Viet Nam

09, 2015

SinhVienZone.com https://fb.com/sinhvienzonevn

SinhVienZone.Com

Trang 2

1 Introduction

2 Reasons to study Concepts of Programming Languages

3 Language Evaluation Criteria

4 Language Design

5 Implementation Methods

SinhVienZone.com https://fb.com/sinhvienzonevn

SinhVienZone.Com

Trang 3

Lecturer In Charge

My name: Nguyen Hua Phung Email: nhphung@hcmut.edu.vn Website: http://cse.hcmut.edu.vn/~phung(pending) Office hour: 15:00-16:30 Thursday (subject to

change)

Sakai: https://elearning.hcmut.edu.vn

SinhVienZone.com https://fb.com/sinhvienzonevn

SinhVienZone.Com

Trang 4

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

SinhVienZone.com https://fb.com/sinhvienzonevn

SinhVienZone.Com

Trang 5

Tutorial/Lab/Online: 15%

Assignment: 25%

Final: 60%

SinhVienZone.com https://fb.com/sinhvienzonevn

SinhVienZone.Com

Trang 6

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

SinhVienZone.com https://fb.com/sinhvienzonevn

SinhVienZone.Com

Trang 7

Benefits of Studying

Increased capacity to express idea Improved background for choosing appropriate languages

Increased ability to learn new languages Better understanding of the significance of implementation

Better use of languages that are already known Overall advancement of computing

SinhVienZone.com https://fb.com/sinhvienzonevn

SinhVienZone.Com

Trang 8

Programming Domains

Scientific Applications Fortran, ALGOL 60 Business Applications COBOL

Artificial Intelligence LISP, Prolog

Systems Programming PL/S, BLISS, Extended ALGOL, and C Web Software

XHTML, JavaScript, PHP

SinhVienZone.com https://fb.com/sinhvienzonevn

SinhVienZone.Com

Trang 9

Language Characteristics

Simplicity Orthogonality Support of abstraction (Control, Data) Safety

SinhVienZone.com https://fb.com/sinhvienzonevn

SinhVienZone.Com

Trang 10

Readability Writability Reliability Cost

SinhVienZone.com https://fb.com/sinhvienzonevn

SinhVienZone.Com

Trang 11

Influences on Language Design

Computer Architecture

Von Neumann

Programming Methodologies

Imperative

Machine-based Procedural

Declarative

Logic Functional Constraint Query-based

Object-Oriented

SinhVienZone.com https://fb.com/sinhvienzonevn

SinhVienZone.Com

Trang 12

Computer Architecture Influence

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 efficient

SinhVienZone.com https://fb.com/sinhvienzonevn

SinhVienZone.Com

Trang 13

Programming Methodologies Influences

1950s and early 1960s: Simple applications; worry about machine efficiency

Late 1960s: Efficiency became important; readability, better control structures

Structured programming Top-down design and step-wise refinement

Late 1970s: Process-oriented to data-oriented

data abstraction

Middle 1980s: Object-oriented programming

Data abstraction + inheritance + polymorphism

SinhVienZone.com https://fb.com/sinhvienzonevn

SinhVienZone.Com

Trang 14

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 specified 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

SinhVienZone.com https://fb.com/sinhvienzonevn

SinhVienZone.Com

Trang 15

Language Design Trade-Offs

Reliability vs cost of execution

Conflicting 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 conflicting 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 (flexibility) vs reliability

Another conflicting criteria Example: C++ pointers are powerful and very flexible but not reliably used

SinhVienZone.com https://fb.com/sinhvienzonevn

SinhVienZone.Com

Trang 16

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

SinhVienZone.com https://fb.com/sinhvienzonevn

SinhVienZone.Com

Trang 17

Implementation Methods

Compiler Source

Execution Data

Result

Interpreter Source

Data

Result

Compiler Source

Interpreter Data

Result

SinhVienZone.com https://fb.com/sinhvienzonevn

SinhVienZone.Com

Trang 18

Compilation Phases

source program lexical analyzer syntax analyzer semantic analyzer intermediate code generator

code optimizer code generator target program

front end

back end

SinhVienZone.com https://fb.com/sinhvienzonevn

SinhVienZone.Com

Trang 19

Related Programs

Preprocessor Assembler Linker Loader Debugger Editor

SinhVienZone.com https://fb.com/sinhvienzonevn

SinhVienZone.Com

Trang 20

What are still in your mind?

SinhVienZone.com https://fb.com/sinhvienzonevn

SinhVienZone.Com

Ngày đăng: 30/01/2020, 22:16

TỪ KHÓA LIÊN QUAN

TÀI LIỆU CÙNG NGƯỜI DÙNG

TÀI LIỆU LIÊN QUAN

🧩 Sản phẩm bạn có thể quan tâm