TAILIEUCHUNG - Lecture Programming languages (2/e): Chapter 8a - Tucker, Noonan

The implementation of run-time semantics is also of interest in a deeper study of semantics. How does an interpreter work, and what is the connection between an interpreter and the specification of a language's semantics? These deeper questions are studied in Chapter 8. Chapter 8 - Semantic interpretation, this chapter presents the following content: State transformations and partial functions, semantics of clite. | Programming Languages 2nd edition Tucker and Noonan Chapter 8 Semantic Interpretation To understand a program you must become both the machine and the program. A. Perlis Contents State Transformations and Partial Functions Semantics of Clite Semantics with Dynamic Typing A Formal Treatment of Semantics Semantics of a PL Defines the meaning of a program Syntactically valid Static type checking valid Historical Problem Valid program had different meanings on different machines More than (.) size of an int or float Problem was lack of precision in defining meaning Methods Compiler C on Machine M Ex: Fortran on IBM 709/7090 Ex: PL/1 (F) on IBM 360 series Operational Semantics – Ch. 7 Axiomatic Semantics – Ch. 18 Denotational Semantics – Ch. Example Environment i, j at memory locations 154, 155 { , } State i has value 13, j has value -1 { ., , , .} Simple State Ignore environment Set of identifier – value pairs Ex: { , Special value undefined State Transformations Defn: The denotational semantics of a language defines the meanings of abstract language elements as a collection of state-transforming functions. Defn: A semantic domain is a set of values whose properties and operations are independently well-understood and upon which the rules that define the semantics of a language can be based. Meaningless Program for (i = 1; i > -1; i++) i--; // i flips between 0 and 1 // why??? Meaningless Expression Are all expressions meaningful? Give examples C++Lite Semantics State – represent the set of all program states A meaning function M is a mapping: M: Program → State M: Statement x State → State M: Expression x State → Value Meaning Rule The meaning of a Program is defined to be the meaning of the body when given an initial state consisting of the variables of the decpart initialized to the undef value corresponding to the variable's type. State M (Program p) { // Program = Declarations

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.