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

Slides:



Advertisements
Similar presentations
ICE1341 Programming Languages Spring 2005 Lecture #13 Lecture #13 In-Young Ko iko.AT. icu.ac.kr iko.AT. icu.ac.kr Information and Communications University.
Advertisements

ICE1341 Programming Languages Spring 2005 Lecture #6 Lecture #6 In-Young Ko iko.AT. icu.ac.kr iko.AT. icu.ac.kr Information and Communications University.
ICE1341 Programming Languages Spring 2005 Lecture #12 Lecture #12 In-Young Ko iko.AT. icu.ac.kr iko.AT. icu.ac.kr Information and Communications University.
ICE1341 Programming Languages Spring 2005 Lecture #11 Lecture #11 In-Young Ko iko.AT. icu.ac.kr iko.AT. icu.ac.kr Information and Communications University.
ICE1341 Programming Languages Spring 2005 Lecture #5 Lecture #5 In-Young Ko iko.AT. icu.ac.kr iko.AT. icu.ac.kr Information and Communications University.
ICE1341 Programming Languages Spring 2005 Lecture #4 Lecture #4 In-Young Ko iko.AT. icu.ac.kr iko.AT. icu.ac.kr Information and Communications University.
UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering CSCE 330 Programming Language Structures Ch.2: Syntax and Semantics Fall 2005.
Chapter 8 Statement-Level Control Structure. Introduction Levels of Control Flow: 1. Within expressions 2. Among program units 3. Among program statements.
ISBN Chapter 8 Statement-Level Control Structures.
ALGOL 60 Design by committee of computer scientists: Naur, Backus, Bauer, McCarthy, van Wijngaarden, Landin, etc. Design by committee of computer scientists:
ISBN Chapter 8 Statement-Level Control Structures.
ISBN Chapter 5 Names, Bindings, Type Checking, and Scopes Names Variables The Concept of Binding Type Checking Strong Typing Type Compatibility.
Chapter 3 Describing Syntax and Semantics Sections 1-3.
Copyright © 1995 by Addison-Wesley Publishing Co. 1 Names - Design issues: - Maximum length? - Are connector characters allowed? - Are names case sensitive?
Chapter 3 Describing Syntax and Semantics Sections 1-3.
ISBN Chapter 8 Statement-Level Control Structures.
CSE 452: Programming Languages Expressions and Control Flow.
CS 330 Programming Languages 09 / 16 / 2008 Instructor: Michael Eckmann.
ICE1341 Programming Languages Spring 2005 Lecture #8 Lecture #8 In-Young Ko iko.AT. icu.ac.kr iko.AT. icu.ac.kr Information and Communications University.
ICE1341 Programming Languages Spring 2005 Lecture #3 Lecture #3 In-Young Ko iko.AT. icu.ac.kr iko.AT. icu.ac.kr Information and Communications University.
1 Chapter 5: Names, Bindings and Scopes Lionel Williams Jr. and Victoria Yan CSci 210, Advanced Software Paradigms September 26, 2010.
1 Statement-Level Control Structures Levels of flow control Control Statements 1. Sequence 2. Selection 3. Iteration Unconditional branching Guarded commands.
Imperative Programming
March 19, ICE 1341 – Programming Languages (Lecture #8) In-Young Ko Programming Languages (ICE 1341) Lecture #8 Programming Languages (ICE 1341)
COMP4730/2003/lec5/H.Melikian Names, Bindings,Type Checking and Scopes (Chapter 5) - Design issues: - Maximum length? - Are connector characters allowed?
1 CS Programming Languages Class 07 September 14, 2000.
5-1 Chapter 5: Names, Bindings, Type Checking, and Scopes Variables The Concept of Binding Type Checking Strong Typing Type Compatibility Scope and Lifetime.
March 12, ICE 1341 – Programming Languages (Lecture #6) In-Young Ko Programming Languages (ICE 1341) Lecture #6 Programming Languages (ICE 1341)
PLLab, NTHU,Cs2403 Programming Languages Expression and control structure Kun-Yuan Hsieh Programming Language Lab., NTHU.
Introduction A variable can be characterized by a collection of properties, or attributes, the most important of which is type, a fundamental concept in.
March 5, ICE 1341 – Programming Languages (Lecture #4) In-Young Ko Programming Languages (ICE 1341) Lecture #4 Programming Languages (ICE 1341)
ISBN Chapter 8 Statement-Level Control Structures.
Arithmetic Expressions
8-1 Statement-Level Control Structures Introduction Selection Statements Iterative Statements Unconditional Branching Guarded Commands Conclusions.
April 16, ICE 1341 – Programming Languages (Lecture #14) In-Young Ko Programming Languages (ICE 1341) Lecture #14 Programming Languages (ICE 1341)
1 CS Programming Languages Class 09 September 21, 2000.
Principle of Programming Lanugages 3: Compilation of statements Statements in C Assertion Hoare logic Department of Information Science and Engineering.
March 31, ICE 1341 – Programming Languages (Lecture #11) In-Young Ko Programming Languages (ICE 1341) Lecture #11 Programming Languages (ICE 1341)
ISBN Variables, Names, Scope and Lifetime ICOM 4036 Lecture 9.
1 Structure of Compilers Lexical Analyzer (scanner) Modified Source Program Parser Tokens Semantic Analysis Syntactic Structure Optimizer Code Generator.
Chapter 8 © 2002 by Addison Wesley Longman, Inc Introduction - Levels of Control Flow: 1. Within expressions 2. Among program units 3. Among program.
Chapter 1: Preliminaries Lecture # 2. Chapter 1: Preliminaries Reasons for Studying Concepts of Programming Languages Programming Domains Language Evaluation.
Chapter 7 Expressions and Assignment Statements. Copyright © 2012 Addison-Wesley. All rights reserved.1-2 Chapter 7 Topics Introduction Arithmetic Expressions.
ISBN Chapter 7 Expressions and Assignments Statements.
Chapter 3 – Describing Syntax
Records Design Issues: 1. What is the form of references?
Chapter 8: Control Structures
Midterm Review In Text: Chapters 1, 2, 3, 5, 15.
Final Review In Text: Chapters 1-3, 5-11,
Midterm Review In Text: Chapters 1-3, 5, 15.
Midterm Review In Text: Chapters 1-3, 5-7, 15, 16.
Final Review In Text: Chapters 1-11,
Final Review In Text: Chapters 1-3, 5-10, 12,
Final Review In Text: Chapters 1-3, 5-10, 12,
Final Review In Text: Chapters 1-3, 5-10,
Midterm Review In Text: Chapters 1, 2, 3, 5, 6, 15.
Midterm Review In Text: Chapters 1, 2, 3, 5, 15.
Midterm Review In Text: Chapters 1-3, 5-9, 15.
Final Review In Text: Chapters 1-3, 5-10,
Midterm Review In Text: Chapters 1-3, 5-6, 15.
CSCE 330 Programming Language Structures Ch.2: Syntax and Semantics
Midterm Review In Text: Chapters 1-3, 5-10, 15.
Final Review In Text: Chapters 1-3, 5-12,
Final Review In Text: Chapters 1-9, 11, 14, 15.
Final Review In Text: Chapters 1-3, 5-16.
Final Review In Text: Chapters 1-3, 5-16.
Midterm Review In Text: Chapters 1-3, 5-9, 15.
Midterm Review In Text: Chapters 1-3, 5-11, 15.
Presentation transcript:

April 2, 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

April 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

April 2, 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

April 2, 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

April 2, 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 RESULT = 1 20 CONTINUE

April 2, 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

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

April 2, 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

April 2, 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

April 2, 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

April 2, 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

April 2, 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

April 2, 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)

April 2, 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)

April 2, 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