Presentation is loading. Please wait.

Presentation is loading. Please wait.

April 2, 2004 1 ICE 1341 – Programming Languages (Lecture #12) In-Young Ko Programming Languages (ICE 1341) Lecture #12 Programming Languages (ICE 1341)

Similar presentations


Presentation on theme: "April 2, 2004 1 ICE 1341 – Programming Languages (Lecture #12) In-Young Ko Programming Languages (ICE 1341) Lecture #12 Programming Languages (ICE 1341)"— Presentation transcript:

1 April 2, 2004 1 ICE 1341 – Programming Languages (Lecture #12) In-Young Ko Programming Languages (ICE 1341) Lecture #12 Programming Languages (ICE 1341) Lecture #12 April 2, 2004 In-Young Ko iko.AT. icu.ac.kr Information and Communications University (ICU) iko.AT. icu.ac.kr

2 April 2, 2004 2 ICE 1341 – Programming Languages (Lecture #12) In-Young Ko Announcements The project #1 is due by midnight today The project #1 is due by midnight today Please submit your project report to F607 Please submit your project report to F607 The midterm exam will be on: The midterm exam will be on: April 9 th, 1:00PM-3:00PM, L401 It’s closed-book and closed-note It’s closed-book and closed-note The exam will cover: Chapter 1, Chapter 3 (except 3.5.3), Chapter 5, Chapter 6 (except 6.9.9), Chapter 7 The exam will cover: Chapter 1, Chapter 3 (except 3.5.3), Chapter 5, Chapter 6 (except 6.9.9), Chapter 7

3 April 2, 2004 3 ICE 1341 – Programming Languages (Lecture #12) In-Young Ko Review of the Previous Lecture Arithmetic Expressions Arithmetic Expressions Operator Evaluation Rules Operator Evaluation Rules Side Effects Side Effects Overloaded Operators Overloaded Operators Short-Circuit Evaluation Short-Circuit Evaluation Assignment Statements Assignment Statements Mixed-mode Assignment Mixed-mode Assignment

4 April 2, 2004 4 ICE 1341 – Programming Languages (Lecture #12) In-Young Ko Control Structures Control Structure: a control statement and the statements whose execution it controls Control Structure: a control statement and the statements whose execution it controls Selection Statements Selection Statements Iterative Statements Iterative Statements Unconditional Branching Unconditional Branching Guarded Commands Guarded Commands Levels of Control Flow Levels of Control Flow Within expressions Within expressions Among program statements Among program statements Among program units Among program units

5 April 2, 2004 5 ICE 1341 – Programming Languages (Lecture #12) In-Young Ko Selection Statements Selection Statement: a means of choosing between two or more paths of execution Selection Statement: a means of choosing between two or more paths of execution Two general categories: Two-way selectors, Multiple- way selectors Two general categories: Two-way selectors, Multiple- way selectors Design Issues of Two-way Selectors Design Issues of Two-way Selectors What is the form and type of the control expression? What is the form and type of the control expression? How are the then and else clauses specified? How are the then and else clauses specified? How should the meaning of nested selectors be specified? How should the meaning of nested selectors be specified? if (sum == 0) if (count == 0) result = 0; result = 0;else result = 1; IF (SUM.NE. 0) GOTO 10 IF (SUM.NE. 0) GOTO 10 IF (COUNT.NE. 0) GOTO 20 IF (COUNT.NE. 0) GOTO 20 RESULT = 0 RESULT = 0 GOTO 20 GOTO 20 10 RESULT = 1 20 CONTINUE

6 April 2, 2004 6 ICE 1341 – Programming Languages (Lecture #12) In-Young Ko Nested Selectors ALGOL 60 – disallow direct nesting ALGOL 60 – disallow direct nesting if... then if... then begin begin if...then... if...then... end end else... else... Java – else goes with the nearest if Java – else goes with the nearest if if... if... if... else... else... FORTRAN 90 and Ada – closing special words FORTRAN 90 and Ada – closing special words if... then if... then if... then... if... then... end if end if else... else... end if end if

7 April 2, 2004 7 ICE 1341 – Programming Languages (Lecture #12) In-Young Ko Review of Chapters for the Midterm Exam

8 April 2, 2004 8 ICE 1341 – Programming Languages (Lecture #12) In-Young Ko Review of Chapter 1 Programming Domains Programming Domains Programming Paradigms Programming Paradigms Language Evaluation Criteria Language Evaluation Criteria Readability Factors Readability Factors Writability Factors Writability Factors Reliability Factors Reliability Factors Imperative Languages Imperative Languages Overview of Language Processors Overview of Language Processors

9 April 2, 2004 9 ICE 1341 – Programming Languages (Lecture #12) In-Young Ko Review of Chapter 3 - Syntax Syntax vs. Semantics Syntax vs. Semantics Language Recognizers vs. Language Generators Language Recognizers vs. Language Generators Formal ways to define language syntax Formal ways to define language syntax Context-free Grammar Context-free Grammar Chomsky Hierarchy Chomsky Hierarchy BNF (Backus Naur Form), EBNF BNF (Backus Naur Form), EBNF Derivations Derivations Parse Trees Parse Trees Ambiguity in Grammars Ambiguity in Grammars Operator Precedence Operator Precedence Associativity of Operators Associativity of Operators Attribute Grammars Attribute Grammars

10 April 2, 2004 10 ICE 1341 – Programming Languages (Lecture #12) In-Young Ko Review of Chapter 3 - Semantics Operational Semantics: states of a machine Operational Semantics: states of a machine Axiomatic Semantics: preconditions, postconditions, weakest preconditions Axiomatic Semantics: preconditions, postconditions, weakest preconditions Axiom of Assignment Axiom of Assignment Rules of Consequence Rules of Consequence Rules of Composition Rules of Composition Rules of Selection Rules of Selection Rules of Iteration Rules of Iteration

11 April 2, 2004 11 ICE 1341 – Programming Languages (Lecture #12) In-Young Ko Review of Chapter 5 – Names and Bindings Design Issues for Names Design Issues for Names Sextuple of Attributes for Names: (name, address, value, type, lifetime, and scope) Sextuple of Attributes for Names: (name, address, value, type, lifetime, and scope) Binding Times Binding Times Type Bindings: Static Type Bindings, Dynamic Type Bindings, Type Inference Type Bindings: Static Type Bindings, Dynamic Type Bindings, Type Inference Binding Lifetimes: Static, Stack-Dynamic, Explicity Heap-Dynamic, Implicit Heap-Dynamic Binding Lifetimes: Static, Stack-Dynamic, Explicity Heap-Dynamic, Implicit Heap-Dynamic Type Compatibility: Name Type Compatibility, Structure Type Compatibility, Derived Types, Subtypes, Anonymous Types Type Compatibility: Name Type Compatibility, Structure Type Compatibility, Derived Types, Subtypes, Anonymous Types

12 April 2, 2004 12 ICE 1341 – Programming Languages (Lecture #12) In-Young Ko Review of Chapter 5 – Scope Rules Variable Visibility Variable Visibility Nested Static Scopes Nested Static Scopes Program Blocks Program Blocks Problems in Static Scoping Problems in Static Scoping Dynamic Scopes Dynamic Scopes Scope and Lifetime Scope and Lifetime Reference Environments: a set of visible names Reference Environments: a set of visible names Named Constants: static (manifest) or dynamic constants Named Constants: static (manifest) or dynamic constants Variable Initialization Variable Initialization

13 April 2, 2004 13 ICE 1341 – Programming Languages (Lecture #12) In-Young Ko Review of Web-based Languages WWW Concepts: Universal Readership, Hypertext, Client-Server Model, Searching, Format Negotiation WWW Concepts: Universal Readership, Hypertext, Client-Server Model, Searching, Format Negotiation Extended Markup Language (XML) Extended Markup Language (XML) Basic language components Basic language components XML Processors: XML Parsers, Document Type Declaration (DTD), XML Schema (XSD), eXtensible Stylesheet Language (XSL) XML Processors: XML Parsers, Document Type Declaration (DTD), XML Schema (XSD), eXtensible Stylesheet Language (XSL) Document Object Model (DOM) Document Object Model (DOM)

14 April 2, 2004 14 ICE 1341 – Programming Languages (Lecture #12) In-Young Ko Review of Chapter 6 Associative Arrays Associative Arrays Record Types Record Types Union Types: Free Unions, Discriminated Unions Union Types: Free Unions, Discriminated Unions Pointer Types Pointer Types Dangling Pointers Dangling Pointers Lost Heap-Dynamic Variables (Garbage, Memory Leaks) Lost Heap-Dynamic Variables (Garbage, Memory Leaks) Reference Types (Aliasing) Reference Types (Aliasing)

15 April 2, 2004 15 ICE 1341 – Programming Languages (Lecture #12) In-Young Ko Review of Chapter 7 Arithmetic Expressions: Unary Operators, Binary Operators, Ternary Operators Arithmetic Expressions: Unary Operators, Binary Operators, Ternary Operators Operator Evaluation Rules Operator Evaluation Rules Operator Precedence Rules Operator Precedence Rules Operator Associativity Rules Operator Associativity Rules Operand Evaluation Oder Operand Evaluation Oder Side Effects Side Effects Overloaded Operators Overloaded Operators Type Conversions: Narrowing, Widening, Coercion, Type Caseing Type Conversions: Narrowing, Widening, Coercion, Type Caseing Short-Circuit Evaluation Short-Circuit Evaluation Types of Assignment Statements Types of Assignment Statements


Download ppt "April 2, 2004 1 ICE 1341 – Programming Languages (Lecture #12) In-Young Ko Programming Languages (ICE 1341) Lecture #12 Programming Languages (ICE 1341)"

Similar presentations


Ads by Google