TAILIEUCHUNG - Lecture Programming languages (2/e): Chapter 10b - Tucker, Noonan

Chapter 10b - Formal treatment of types and semantics. This section repeats the above two sections using a fmmal mathematical style. Its purpose is to illustrate the power of denotational semantics to enable the full specification of a programming language's type system and semantics. Since it is machine independent, this notation can be used by language and compiler designers as they define and implement new programming languages. | Programming Languages 2nd edition Tucker and Noonan Chapter 10 Function Implementation In theory, there is no difference between theory and practice, but not in practice. Anonymous Contents Function Declaration and Call in Clite Completing the Clite Type System Semantics of Call and Return Formal Treatment of Types and Semantics Formal Treatment of Types and Semantics The type map for a function f, tmf, is a set of pairs and triples, representing global variables (tmG), functions (tmF), f’s parameters, and f’s locals. ., for the program in Figure : Typing Function The function typing creates type maps for each individual function f in a program with globals G and functions F. Validity of a Clite Program A program is valid if its global variables and function declarations are valid, and each function is valid with respect to their type maps. Validity of a Clite Function A function is valid if 1) its parameters and locals have unique names, 2) its statements are valid in its type map, and 3) it contains (does not contain) a return statement if it is a non-void (void) function. Validity of a Clite Call and Return Validity of most Clite statements is defined in Chapter 6. Validity of a Call and a Return is defined below: Formalizing the Semantics of Clite Memory ( ), Environment ( ) and State ( ): The State of a function f, f , is a triple f a where a addresses the top of the run-time stack, is a set of address-value pairs, and f has f’s visible variables and their addresses. Allocate and Deallocate Functions allocate changes the state by adding a group of variable-address pairs to it. deallocate removes such a group. Calling a Void Function Meaning Rule in functional form, skipping temporarily the returned result: Call/Return for a Non-Void Function The Call returns a Value; the Return identifies it: Meaning of a Block Since a block can contain a Return, it must exit as soon as the return is encountered (Meaning Rule .

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.