Đang chuẩn bị liên kết để tải về tài liệu:
Lecture Programming languages (2/e): Chapter 10a - Tucker, Noonan

Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ

Chapter 10 - Function implementation. The stack implementation of function call and return is a central topic deserving deeper study. Moreover, strategies for the management of another memory area called the heap, are important to the understanding of dynamic objects like arrays. Chapter 10a presents the following content: Function declaration and call in clite, completing the clite type system, semantics of call and return. | 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 10.1 Function Declaration and Call in Clite 10.2 Completing the Clite Type System 10.3 Semantics of Call and Return 10.4 Formal Treatment of Types and Semantics 10.1 Function Declaration and Call Example Clite Program Fig 10.1 int h, i; void B(int w) { int j, k; i = 2*w; w = w+1; } void A(int x, int y) { bool i, j; B(h); } int main() { int a, b; h = 5; a = 3; b = 2; A(a, b); } 10.1.1 Concrete Syntax Functions and Globals (new elements underlined) Program { Type Identifier FunctionOrGlobal } MainFunction Type int | boolean | float | char | void FunctionOrGlobal ( Parameters ) { Declarations Statements } | Global Parameters [ Parameter { , Parameter } ] Global { , Identifier } ; MainFunction int main ( ) { Declarations Statements } Concrete Syntax (cont’d) Function Calls (new elements underlined) Statement ; | Block | Assignment | IfStatement | WhileStatement | CallStatement | ReturnStatement CallStatement Call ; ReturnStatement return Expression ; Factor Identifier | Literal | ( Expression ) | Call Call Identifier ( Arguments ) Arguments [ Expression { , Expression } ] 10.1.2 Abstract Syntax Program = Declarations globals; Functions functions Functions = Function* Function = Type t; String id; Declarations params, locals; Block body Type = int | boolean | float | char | void Statement = Skip | Block | Assignment | Conditional | Loop | Call | Return Call = String name; Expressions args Expressions = Expression* Return = Variable target; Expression result Expression = Variable | Value | Binary | Unary | Call Abstract Syntax for a Clite Program Fig 10.4 globals body Program Functions Declarations Function Function Function int main void A void B params locals body h i w A(a,b); a b i j x y w = w + 1; i = 2 * w; j k Block Call 10.2 Completing the Clite Type . | 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 10.1 Function Declaration and Call in Clite 10.2 Completing the Clite Type System 10.3 Semantics of Call and Return 10.4 Formal Treatment of Types and Semantics 10.1 Function Declaration and Call Example Clite Program Fig 10.1 int h, i; void B(int w) { int j, k; i = 2*w; w = w+1; } void A(int x, int y) { bool i, j; B(h); } int main() { int a, b; h = 5; a = 3; b = 2; A(a, b); } 10.1.1 Concrete Syntax Functions and Globals (new elements underlined) Program { Type Identifier FunctionOrGlobal } MainFunction Type int | boolean | float | char | void FunctionOrGlobal ( Parameters ) { Declarations Statements } | Global Parameters [ Parameter { , Parameter } ] Global { , Identifier } ; MainFunction int main ( ) { Declarations Statements } Concrete Syntax (cont’d) Function Calls (new elements .

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.