HANDLING NONLOCAL REFERENCES

Size: px
Start display at page:

Download "HANDLING NONLOCAL REFERENCES"

Transcription

1 SYMBOL TABLE A symbol table is a data structure kept by a translator that allows it to keep track of each declared name and its binding. Assume for now that each name is unique within its local scope. The data structure can be any implementation of a dictionary, where the name is the key. 1

2 HANDLING NONLOCAL REFERENCES 1. Each time a scope is entered, push a new dictionary onto the stack. 2. Each time a scope is exited, pop a dictionary off the top of the stack. 3. For each name declared, generate an appropriate binding and enter the name-binding pair into the dictionary on the top of the stack. 4. Given a name reference, search the dictionary on top of the stack: a) If found, return the binding. b) Otherwise, repeat the process on the next dictionary down in the stack. c) If the name is not found in any dictionary, report an error. 2

3 EXAMPLE DICTIONARY STACK 1 void sort (float a[ ], int size) { 2 int i, j; 3 for (i = 0; i < size; i++) 4 for (j = i + 1; j < size; j++) 5 if (a[j] < a[i]) { 6 float t; 7 t = a[i]; 8 a[i] = a[j]; 9 a[j] = t; 10 } 11 } At line 4 and 11: <j, 2> <i, 2> <size,1> <a, 1> <sort, 1> At line 7: <t, 6> <j, 2> <i, 2> <size,1> <a, 1> <sort, 1> 3

4 STATIC SCOPING For static scoping, the referencing environment for a name is its defining scope and all nested subscopes. The referencing environment defines the set of statements which can validly reference a name. 4

5 DYNAMIC SCOPING In dynamic scoping, a name is bound to its most recent declaration based on the program s call history. Used be early Lisp, APL, Snobol, Perl. Symbol table for each scope built at compile time, but managed at run time. Scope pushed/popped on stack when entered/exited. 5

6 1 int h, i; 2 void B(int w) { 3 int j, k; 4 i = 2*w; 5 w = w+1; } 8 void A (int x, int y) { 9 float i, j; 10 B(h); 11 i = 3; } 14 void main() { 15 int a, b; 16 h = 5; a = 3; b = 2; 17 A(a, b); 18 B(h); } 6

7 RUNTIME SYMBOL TABLE Call history main (17) A (10) B Function Dictionary B <w, 2> <j, 3> <k, 3> A <x, 8> <y, 8> <i, 9> <j, 9> main <a, 15> <b, 15> <h, 1> <i, 1> <B, 2> <A, 8> <main, 14> Reference to i (4) resolves to <i, 9> in A. 7

8 1 int h, i; 2 void B(int w) { 3 int j, k; 4 i = 2*w; 5 w = w+1; } 8 void A (int x, int y) { 9 float i, j; 10 B(h); 11 i = 3; } 14 void main() { 15 int a, b; 16 h = 5; a = 3; b = 2; 17 A(a, b); 18 B(h); } 8

9 RUNTIME SYMBOL TABLE (AGAIN) Same example: call history main (17) B Function Dictionary B <w, 2> <j, 3> <k, 3> main <a, 15> <b, 15> <h, 1> <i, 1> <B, 2> <A, 8> <main, 14> Reference to i (4) resolves to <i, 1> in global scope. 9

10 DISADVANTAGES OF DYNAMIC SCOPING Compromises the ability to statically type check references to non-local variables Variables in a function visible to other functions which call this function program less reliable Access to non-local variable follows chains of dynamic links more time consuming Therefore most modern languages prefer static scoping! 10

11 VISIBILITY A name is visible if its referencing environment includes the reference and the name is not redeclared in an inner scope. A name redeclared in an inner scope effectively hides the outer declaration. Some languages provide a mechanism for referencing a hidden name; e.g.: this.x in C++/Java. 11

12 EXAMPLE JAVA PROGRAM 1 public class Student { 2 private String name; 3 public Student (String name,...) { 4 this.name = name; } 7 } 12

13 OVERLOADING Overloading uses the number or type of parameters to distinguish among identical function names or operators. Examples: +, -, *, / can be float or int + can be float or int addition or string concatenation in Java System.out.print(x) in Java 13

14 LIFETIME The lifetime of a variable is the time interval during which the variable has been allocated a block of memory. Earliest languages used static allocation. Memory assigned at compile time Function only allocated space for arguments and return value recursive function not supported! Algol introduced the notion that memory should be allocated/deallocated at scope entry/exit. Modern languages are based on this idea but may break scope equals lifetime rule. 14

15 TYPES 15

16 BASICS A type is a collection of values and operations on those values. Example: Integer type has values..., -2, -1, 0, 1, 2,... and operations +, -, *, /, <,... The Boolean type has values true and false and operations,,. 16

17 BASICS Computer types have a finite number of values due to fixed size allocation; problematic for numeric types. Exceptions: Smalltalk uses unbounded fractions. Haskell type Integer represents unbounded integers. More problematic is the fixed sized floating point numbers 0.2 is not exact in binary. So 0.2 * 5 is not exactly 1.0 Floating point is inconsistent with real numbers in mathematics. 17

18 BASICS In the early languages, Fortran, Algol, Cobol, all of the types were built in. If needed a type color, could use integers; but what does it mean to multiply two colors? Purpose of types in programming languages is to provide ways of effectively modeling a problem solution. 18

19 TYPE ERRORS Machine data carries no type information. Basically, just a sequence of bits. Example: The floating point number The 32-bit integer 1,079,508,992 Two 16-bit integers and 0 Four ASCII X NUL NUL 19

20 TYPE ERRORS A type error is any error that arises because an operation is attempted on a data type for which it is undefined. Type errors are common in assembly language programming. High level languages reduce the number of type errors. A type system provides a basis for detecting type errors. 20

21 STATIC AND DYNAMIC TYPING A type system imposes constraints such as the values used in an addition must be numeric. Cannot be expressed syntactically in EBNF. Some languages perform type checking at compile time (e.g., C). Other languages (e.g., Perl) perform type checking at run time. Still others (e.g., Java) do both. 21

22 STATIC AND DYNAMIC TYPING A language is statically typed if the types of all variables are fixed when they are declared at compile time. A language is dynamically typed if the type of a variable can vary at run time depending on the value assigned. Can you give examples of each? Static: C/C++, Java, ML, Haskell Dynamic: Perl, Python, JavaScript, Prolog, Scheme 22

23 BASIC TYPES Terminology in use with current 32-bit computers: Nibble: 4 bits Byte: 8 bits Half-word: 16 bits Word: 32 bits Double word: 64 bits Quad word: 128 bits 23

24 FINITE SIZE IN TYPES Unlike mathematics: a + (b + c) (a + b) + c (why??) In most languages, the numeric types are finite in size. So a + b may overflow the finite range. Also in C-like languages, the equality and relational operators produce an int, not a Boolean 24

25 OVERLOADING An operator or function is overloaded when its meaning varies depending on the types of its operands or arguments or result. Java: a + b (ignoring size) integer add floating point add string concatenation Mixed mode: one operand an int, the other floating point 25

26 TYPE CONVERSION Type conversion is implicit or explicit change of the type of a value to a different one. Implicit conversion type coercion Explicit conversion type casting A type conversion is a narrowing conversion if the result type permits fewer bits, thus potentially losing information. Otherwise it is termed a widening conversion. Should languages ban implicit narrowing conversions? In PL/I: Why? Lose information declare (a) char (3); a = 123 ; a = a + 1; Unexpected results: 26

27 NONBASIC TYPES Enumeration: enum day {Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday}; enum day myday = Wednesday; In C/C++ the above values of this type are 0,..., 6. More powerful in Java: for (day d : day.values()) Sytem.out.println(d); 27

28 POINTERS C, C++, Ada, Pascal Java??? Value is a memory address Indirect referencing Operator in C: * 28

29 EQUIVALENCE OF ARRAYS AND POINTERS IN C float sum(float a[ ], int n) { int i; float s = 0.0; for (i = 0; i<n; i++) return s; s += a[i]; float sum(float *a, int n) { int i; float s = 0.0; for (i = 0; i<n; i++) s += *a++; return s; 29

30 STRCPY EXAMPLE void strcpy(char *p, char *q) { } while (*p++ = *q++) ; 30

31 POINTER OPERATIONS If T is a type and ref T is a pointer: & : T ref T * : ref T T For an arbitrary variable x: *(&x) = x 31

32 PITFALLS OF POINTERS Bane of reliable software development Error-prone Buffer overflow, memory leaks Particularly troublesome in C Other languages such as Java, Haskell, ML and Prolog completely remove pointers from the vocabulary of the language However internally these languages still makes heavy use of pointers Still can do dynamic allocation/deallocation of memory 32

33 ARRAYS AND LISTS Array: Indexed sequences of values of the same type. Example: int a[10]; float x[3][5]; /* odd syntax vs. math */ char s[40]; /* indices: 0... n-1 */ Default one-dimensional, but possible to have array of arrays: x[3][5] is an array of 5 3-element arrays (odd syntax!) 33

34 INDEXING Only operation for many languages Type signature [ ] : T[ ] x int T Example float x[3] [5]; type of x: float[ ][ ] type of x[1]: float[ ] type of x[1][2]: float 34

35 STRUCTURES Analogous to a tuple in mathematics Collection of elements of different types Used first in Cobol, PL/I Absent from Fortran, Algol 60 Common to Pascal-like, C-like languages Omitted from Java as redundant 35

36 STRUCTURE (CONT D) struct employeetype { int id; char name[26]; int age; float salary; char dept; }; struct employeetype employee;... employee.age = 45; Number of bytes employeetype requires? (assuming 32-bit int) Answer: 39 bytes Memory allocation may have special requirement Reverse order of allocation 32-bit int or float must be allocated at address multiple of 4 How many bytes are needed? Answer: 44 bytes 36

37 UNIONS C: union Pascal: case-variant record Logically: multiple views of same storage Useful in some systems applications 37

38 FUNCTIONS AS TYPES First-class citizens : Can be assigned a value Can be passed as an argument to a function Pascal example: function newton(a, b: real; function f: real): real; Know that f returns a real value, but the arguments to f are unspecified. Java interface class: public interface RootSolvable { double valueat(double x); } public double Newton(double a, double b, RootSolvable f); 38

39 SUBTYPES A subtype is a type that has certain constraints placed on its values or operations. In Ada subtypes can be directly specified: subtype one_to_ten is Integer range ; type Day is (Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday); subtype Weekend is Day range Saturday.. Sunday; type Salary is delta 0.01 digits 9 range _999_999.99; subtype Author_Salary is Salary digits 5 range ; 39

40 SUBTYPES (CONT D) Java implements subtypes using class hierarchy: Integer i = new Integer(3);... Number v = i;... Integer x = (Integer) v; //Integer is a subclass of Number, // and therefore a subtype Type cast required In general, t: T, s: S, t = s is possible only if: T = S, or S is a subtype of T 40

41 POLYMORPHISM AND GENERICS Greek: poly means many, morph means form/shape A function or operation is polymorphic if it can be applied to any one of several related types and achieve the same result. An advantage of polymorphism is that it enables code reuse. 41

42 POLYMORPHISM Example: overloaded built-in operators and functions + - * / ==!=... Java: + also used for string concatenation Ada 83 Ada, C++: define for new types Java overloaded methods: number or type of parameters Example: class PrintStream print, println defined for: boolean, char, int, long, float, double, char[ ] String, Object 42

43 SEMANTICS 43

44 MOTIVATION To provide an authoritative definition of the meaning of all language constructs for: Programmers Compiler writers Standards developers A programming language is complete only when its syntax, type system, and semantics are well-defined. 44

45 MOTIVATION (CONT D) Semantics is a precise definition of the meaning of a syntactically and type-wise correct program. Ideas of meaning : Operational Semantics: The meaning attached by compiling using compiler C and executing using machine M. Ex: Fortran on IBM 709. Axiomatic Semantics: Program Verification Denotational Semantics: Statements as state transforming functions High level mathematic precision 45

46 EXPRESSION SEMANTICS Expression Semantics: Operators + associativity + precedence Evaluation orders Pure vs. Impure 46

47 AN EXAMPLE Infix (a + b) (c * d) Infix uses associativity and precedence to disambiguate. Polish Prefix: - + a b * c d Polish Postfix: a b + c d * - Same symbol can t be used for operations of different arities Cambridge Polish: (- (+ a b) (* c d)) 47

48 SHORT CIRCUIT EVALUATION Traditionally, a op b is evaluated as eval (a) and eval (b) and then op Optimization: a and b evaluated as: if a then b else false a or b evaluated as: if a then true else b Also known as lazy evaluation: b can be undefined 48

49 SIDE EFFECT A change to any non-local variable or I/O. What is the value of: i = 2; b = 2; c = 5; a = b * i++ + c * i; Depends on which one is evaluated first: b * i++ or c * I Side Effects make a language impure and should be avoided if possible! 49

50 PROGRAM STATE (IMPERATIVE & OO) The state of a program is the bindings of all active variables and their current values. Maps: the pairing of active variable names with specific memory locations environment the pairing of active memory locations with their current values memory state = memory environment 50

51 PROGRAM STATE (CONT D) The current statement (portion of an abstract syntax tree) to be executed in a program is interpreted relative to the current state. The individual steps that occur during a program run can be viewed as a series of state transformations. For the purposes of this lecture, use only a map from a variable to its value; like a debugger watch window, tied to a particular statement. 51

52 THE FACTORIAL PROGRAM // compute the factorial of n 1 void main ( ) { 2 int n, i, f; 3 n = 3; 4 i = 1; 5 f = 1; 6 while (i < n) { 7 i = i + 1; 8 f = f * i; 9 } 10 } 52

53 // compute the factorial of n 1 void main ( ) { 2 int n, i, f; 3 n = 3; 4 i = 1; 5 f = 1; 6 while (i < n) { 7 i = i + 1; 8 f = f * i; 9 } 10 } n i f undef undef undef 53

54 // compute the factorial of n 1 void main ( ) { 2 int n, i, f; 3 n = 3; 4 i = 1; 5 f = 1; 6 while (i < n) { 7 i = i + 1; 8 f = f * i; 9 } 10 } n i f 3 undef undef 54

55 // compute the factorial of n 1 void main ( ) { 2 int n, i, f; 3 n = 3; 4 i = 1; 5 f = 1; 6 while (i < n) { 7 i = i + 1; 8 f = f * i; 9 } 10 } n i f 3 1 undef 55

56 // compute the factorial of n 1 void main ( ) { 2 int n, i, f; 3 n = 3; 4 i = 1; 5 f = 1; 6 while (i < n) { 7 i = i + 1; 8 f = f * i; 9 } 10 } n i f

57 // compute the factorial of n 1 void main ( ) { 2 int n, i, f; 3 n = 3; 4 i = 1; 5 f = 1; 6 while (i < n) { 7 i = i + 1; 8 f = f * i; 9 } 10 } n i f

58 // compute the factorial of n 1 void main ( ) { 2 int n, i, f; 3 n = 3; 4 i = 1; 5 f = 1; 6 while (i < n) { 7 i = i + 1; 8 f = f * i; 9 } 10 } n i f

59 // compute the factorial of n 1 void main ( ) { 2 int n, i, f; 3 n = 3; 4 i = 1; 5 f = 1; 6 while (i < n) { 7 i = i + 1; 8 f = f * i; 9 } 10 } n i f

60 // compute the factorial of n 1 void main ( ) { 2 int n, i, f; 3 n = 3; 4 i = 1; 5 f = 1; 6 while (i < n) { 7 i = i + 1; 8 f = f * i; 9 } 10 } n i f

61 ASSIGNMENT SEMANTICS Fundamental to imperative and object-oriented programming Issues Multiple assignment Assignment statement vs. expression Copy vs. reference semantics Semantics of assignment: Evaluate the source expression a value Replace the value of the target variable a state 61

62 COPY VS. REFERENCE SEMANTICS Copy: a = b; a, b have same value. Changes to either have no effect on other. Used in imperative languages. Reference a, b point to the same object. A change in object state affects both Used by many object-oriented languages. 62

63 COPY VS. REFERENCE SEMANTICS public void add (Object word, Object number) { Vector set = (Vector) dict.get(word); if (set == null) { // not in Concordance set = new Vector( ); dict.put(word, set); } if (allowdupl!set.contains(number)) set.addelement(number); } //Under copy semantics, number will not be added to the dictionary, because set is an object referenced from dict. 63

64 CONTROL FLOW SEMANTICS To be complete, an imperative language needs: Statement sequencing Conditional statement Looping statement 64

65 SEQUENCE s1 s2 Semantics: in the absence of a branch (return, break, continue, etc.): First execute s1 Then execute s2 Output state of s1 is the input state of s2 65

66 CONDITIONAL IfStatement if ( Expresion ) Statement [ else Statement ] Example: if (a > b) else z = a; z = b; If the test expression is true then the output state of the conditional is the output state of the then branch Else: the output state of the conditional is the output state of the else branch 66

67 LOOPS WhileStatement while ( Expression ) Statement The expression is evaluated. If it is true, first the statement is executed, and then the loop is executed again. Otherwise the loop terminates. Foreach loop: An iterator is any finite set of values over which a loop can be repeated. 67

CSCI312 Principles of Programming Languages!

CSCI312 Principles of Programming Languages! CSCI312 Principles of Programming Languages! Chapter 5 Types Xu Liu! ! 5.1!Type Errors! 5.2!Static and Dynamic Typing! 5.3!Basic Types! 5.4!NonBasic Types! 5.5!Recursive Data Types! 5.6!Functions as Types!

More information

22c:111 Programming Language Concepts. Fall Types I

22c:111 Programming Language Concepts. Fall Types I 22c:111 Programming Language Concepts Fall 2008 Types I Copyright 2007-08, The McGraw-Hill Company and Cesare Tinelli. These notes were originally developed by Allen Tucker, Robert Noonan and modified

More information

CSCI312 Principles of Programming Languages!

CSCI312 Principles of Programming Languages! CSCI312 Principles of Programming Languages! Scope Xu Liu ! 4.1 Syntactic Issues! 4.2 Variables! 4.3 Scope! 4.4 Symbol Table! 4.5 Resolving References! 4.6 Dynamic Scoping! 4.7 Visibility! 4.8 Overloading!

More information

Names and Types. standard hue names. Dr. Philip Cannata 1

Names and Types. standard hue names. Dr. Philip Cannata 1 Names and Types standard hue names Dr. Philip Cannata 1 10 High Level Languages This Course Jython in Java Java (Object Oriented) ACL2 (Propositional Induction) Relation Algorithmic Information Theory

More information

TYPES, VALUES AND DECLARATIONS

TYPES, VALUES AND DECLARATIONS COSC 2P90 TYPES, VALUES AND DECLARATIONS (c) S. Thompson, M. Winters 1 Names, References, Values & Types data items have a value and a type type determines set of operations variables Have an identifier

More information

Programming Languages Third Edition. Chapter 7 Basic Semantics

Programming Languages Third Edition. Chapter 7 Basic Semantics Programming Languages Third Edition Chapter 7 Basic Semantics Objectives Understand attributes, binding, and semantic functions Understand declarations, blocks, and scope Learn how to construct a symbol

More information

Programming Languages, Summary CSC419; Odelia Schwartz

Programming Languages, Summary CSC419; Odelia Schwartz Programming Languages, Summary CSC419; Odelia Schwartz Chapter 1 Topics Reasons for Studying Concepts of Programming Languages Programming Domains Language Evaluation Criteria Influences on Language Design

More information

Expressions and Assignment

Expressions and Assignment Expressions and Assignment COS 301: Programming Languages Outline Other assignment mechanisms Introduction Expressions: fundamental means of specifying computations Imperative languages: usually RHS of

More information

Types. What is a type?

Types. What is a type? Types What is a type? Type checking Type conversion Aggregates: strings, arrays, structures Enumeration types Subtypes Types, CS314 Fall 01 BGRyder 1 What is a type? A set of values and the valid operations

More information

CSE 307: Principles of Programming Languages

CSE 307: Principles of Programming Languages 1 / 26 CSE 307: Principles of Programming Languages Names, Scopes, and Bindings R. Sekar 2 / 26 Topics Bindings 1. Bindings Bindings: Names and Attributes Names are a fundamental abstraction in languages

More information

LECTURE 17. Expressions and Assignment

LECTURE 17. Expressions and Assignment LECTURE 17 Expressions and Assignment EXPRESSION SYNTAX An expression consists of An atomic object, e.g. number or variable. An operator (or function) applied to a collection of operands (or arguments)

More information

9/21/17. Outline. Expression Evaluation and Control Flow. Arithmetic Expressions. Operators. Operators. Notation & Placement

9/21/17. Outline. Expression Evaluation and Control Flow. Arithmetic Expressions. Operators. Operators. Notation & Placement Outline Expression Evaluation and Control Flow In Text: Chapter 6 Notation Operator evaluation order Operand evaluation order Overloaded operators Type conversions Short-circuit evaluation of conditions

More information

Programming Languages Third Edition. Chapter 9 Control I Expressions and Statements

Programming Languages Third Edition. Chapter 9 Control I Expressions and Statements Programming Languages Third Edition Chapter 9 Control I Expressions and Statements Objectives Understand expressions Understand conditional statements and guards Understand loops and variation on WHILE

More information

Programmiersprachen (Programming Languages)

Programmiersprachen (Programming Languages) 2016-05-13 Preface Programmiersprachen (Programming Languages) coordinates: lecturer: web: usable for: requirements: No. 185.208, VU, 3 ECTS Franz Puntigam http://www.complang.tuwien.ac.at/franz/ps.html

More information

CSC 533: Organization of Programming Languages. Spring 2005

CSC 533: Organization of Programming Languages. Spring 2005 CSC 533: Organization of Programming Languages Spring 2005 Language features and issues variables & bindings data types primitive complex/structured expressions & assignments control structures subprograms

More information

Names, Scopes, and Bindings II. Hwansoo Han

Names, Scopes, and Bindings II. Hwansoo Han Names, Scopes, and Bindings II Hwansoo Han Scope Rules A scope is textual region where bindings are active A program section of maximal size Bindings become active at the entry No bindings change in the

More information

Informal Semantics of Data. semantic specification names (identifiers) attributes binding declarations scope rules visibility

Informal Semantics of Data. semantic specification names (identifiers) attributes binding declarations scope rules visibility Informal Semantics of Data semantic specification names (identifiers) attributes binding declarations scope rules visibility 1 Ways to Specify Semantics Standards Documents (Language Definition) Language

More information

CPSC 3740 Programming Languages University of Lethbridge. Data Types

CPSC 3740 Programming Languages University of Lethbridge. Data Types Data Types A data type defines a collection of data values and a set of predefined operations on those values Some languages allow user to define additional types Useful for error detection through type

More information

Expressions & Assignment Statements

Expressions & Assignment Statements Expressions & Assignment Statements 1 Topics Introduction Arithmetic Expressions Overloaded Operators Type Conversions Relational and Boolean Expressions Short-Circuit Evaluation Assignment Statements

More information

Imperative Programming

Imperative Programming Naming, scoping, binding, etc. Instructor: Dr. B. Cheng Fall 2004 1 Imperative Programming The central feature of imperative languages are variables Variables are abstractions for memory cells in a Von

More information

G Programming Languages Spring 2010 Lecture 6. Robert Grimm, New York University

G Programming Languages Spring 2010 Lecture 6. Robert Grimm, New York University G22.2110-001 Programming Languages Spring 2010 Lecture 6 Robert Grimm, New York University 1 Review Last week Function Languages Lambda Calculus SCHEME review 2 Outline Promises, promises, promises Types,

More information

Chapter 5. Names, Bindings, and Scopes

Chapter 5. Names, Bindings, and Scopes Chapter 5 Names, Bindings, and Scopes Chapter 5 Topics Introduction Names Variables The Concept of Binding Scope Scope and Lifetime Referencing Environments Named Constants 1-2 Introduction Imperative

More information

Data Types. Every program uses data, either explicitly or implicitly to arrive at a result.

Data Types. Every program uses data, either explicitly or implicitly to arrive at a result. Every program uses data, either explicitly or implicitly to arrive at a result. Data in a program is collected into data structures, and is manipulated by algorithms. Algorithms + Data Structures = Programs

More information

Chapter 5 Names, Binding, Type Checking and Scopes

Chapter 5 Names, Binding, Type Checking and Scopes Chapter 5 Names, Binding, Type Checking and Scopes Names - We discuss all user-defined names here - Design issues for names: -Maximum length? - Are connector characters allowed? - Are names case sensitive?

More information

Software II: Principles of Programming Languages. Why Expressions?

Software II: Principles of Programming Languages. Why Expressions? Software II: Principles of Programming Languages Lecture 7 Expressions and Assignment Statements Why Expressions? Expressions are the fundamental means of specifying computations in a programming language

More information

Data Types. Outline. In Text: Chapter 6. What is a type? Primitives Strings Ordinals Arrays Records Sets Pointers 5-1. Chapter 6: Data Types 2

Data Types. Outline. In Text: Chapter 6. What is a type? Primitives Strings Ordinals Arrays Records Sets Pointers 5-1. Chapter 6: Data Types 2 Data Types In Text: Chapter 6 1 Outline What is a type? Primitives Strings Ordinals Arrays Records Sets Pointers Chapter 6: Data Types 2 5-1 Data Types Two components: Set of objects in the type (domain

More information

Note 3. Types. Yunheung Paek. Associate Professor Software Optimizations and Restructuring Lab. Seoul National University

Note 3. Types. Yunheung Paek. Associate Professor Software Optimizations and Restructuring Lab. Seoul National University Note 3 Types Yunheung Paek Associate Professor Software Optimizations and Restructuring Lab. Seoul National University Topics Definition of a type Kinds of types Issues on types Type checking Type conversion

More information

Question No: 1 ( Marks: 1 ) - Please choose one One difference LISP and PROLOG is. AI Puzzle Game All f the given

Question No: 1 ( Marks: 1 ) - Please choose one One difference LISP and PROLOG is. AI Puzzle Game All f the given MUHAMMAD FAISAL MIT 4 th Semester Al-Barq Campus (VGJW01) Gujranwala faisalgrw123@gmail.com MEGA File Solved MCQ s For Final TERM EXAMS CS508- Modern Programming Languages Question No: 1 ( Marks: 1 ) -

More information

Chapter 7. Expressions and Assignment Statements

Chapter 7. Expressions and Assignment Statements Chapter 7 Expressions and Assignment Statements Chapter 7 Topics Introduction Arithmetic Expressions Overloaded Operators Type Conversions Relational and Boolean Expressions Short-Circuit Evaluation Assignment

More information

G Programming Languages - Fall 2012

G Programming Languages - Fall 2012 G22.2110-003 Programming Languages - Fall 2012 Lecture 3 Thomas Wies New York University Review Last week Names and Bindings Lifetimes and Allocation Garbage Collection Scope Outline Control Flow Sequencing

More information

Chapter 7. Expressions and Assignment Statements ISBN

Chapter 7. Expressions and Assignment Statements ISBN Chapter 7 Expressions and Assignment Statements ISBN 0-321-49362-1 Chapter 7 Topics Introduction Arithmetic Expressions Overloaded Operators Type Conversions Relational and Boolean Expressions Short-Circuit

More information

CS 330 Lecture 18. Symbol table. C scope rules. Declarations. Chapter 5 Louden Outline

CS 330 Lecture 18. Symbol table. C scope rules. Declarations. Chapter 5 Louden Outline CS 0 Lecture 8 Chapter 5 Louden Outline The symbol table Static scoping vs dynamic scoping Symbol table Dictionary associates names to attributes In general: hash tables, tree and lists (assignment ) can

More information

Chapter 7. Expressions and Assignment Statements ISBN

Chapter 7. Expressions and Assignment Statements ISBN Chapter 7 Expressions and Assignment Statements ISBN 0-321-33025-0 Chapter 7 Topics Introduction Arithmetic Expressions Overloaded Operators Type Conversions Relational and Boolean Expressions Short-Circuit

More information

Semantic Analysis. Outline. The role of semantic analysis in a compiler. Scope. Types. Where we are. The Compiler Front-End

Semantic Analysis. Outline. The role of semantic analysis in a compiler. Scope. Types. Where we are. The Compiler Front-End Outline Semantic Analysis The role of semantic analysis in a compiler A laundry list of tasks Scope Static vs. Dynamic scoping Implementation: symbol tables Types Static analyses that detect type errors

More information

Concepts of Programming Languages

Concepts of Programming Languages Concepts of Programming Languages Lecture 1 - Introduction Patrick Donnelly Montana State University Spring 2014 Patrick Donnelly (Montana State University) Concepts of Programming Languages Spring 2014

More information

Introduction to Programming Using Java (98-388)

Introduction to Programming Using Java (98-388) Introduction to Programming Using Java (98-388) Understand Java fundamentals Describe the use of main in a Java application Signature of main, why it is static; how to consume an instance of your own class;

More information

Informatica 3 Syntax and Semantics

Informatica 3 Syntax and Semantics Informatica 3 Syntax and Semantics Marcello Restelli 9/15/07 Laurea in Ingegneria Informatica Politecnico di Milano Introduction Introduction to the concepts of syntax and semantics Binding Variables Routines

More information

Data Types In Text: Ch C apter 6 1

Data Types In Text: Ch C apter 6 1 Data Types In Text: Chapter 6 1 Outline What is a type? Primitives Strings Ordinals Arrays Records Sets Pointers 2 Data Types Two components: Set of objects in the type (domain of values) Set of applicable

More information

Chapter 7. Expressions and Assignment Statements (updated edition 11) ISBN

Chapter 7. Expressions and Assignment Statements (updated edition 11) ISBN Chapter 7 Expressions and Assignment Statements (updated edition 11) ISBN 0-321-49362-1 Chapter 7 Topics Introduction Arithmetic Expressions Overloaded Operators Type Conversions Relational and Boolean

More information

LECTURE 18. Control Flow

LECTURE 18. Control Flow LECTURE 18 Control Flow CONTROL FLOW Sequencing: the execution of statements and evaluation of expressions is usually in the order in which they appear in a program text. Selection (or alternation): a

More information

Short Notes of CS201

Short Notes of CS201 #includes: Short Notes of CS201 The #include directive instructs the preprocessor to read and include a file into a source code file. The file name is typically enclosed with < and > if the file is a system

More information

Chapter 6. Structured Data Types. Topics. Structured Data Types. Vectors and Arrays. Vectors. Vectors: subscripts

Chapter 6. Structured Data Types. Topics. Structured Data Types. Vectors and Arrays. Vectors. Vectors: subscripts Topics Chapter 6 Structured Data Types Vectors Arrays Slices Associative Arrays Records Unions Lists Sets 2 Structured Data Types Virtually all languages have included some mechanisms for creating complex

More information

CS201 - Introduction to Programming Glossary By

CS201 - Introduction to Programming Glossary By CS201 - Introduction to Programming Glossary By #include : The #include directive instructs the preprocessor to read and include a file into a source code file. The file name is typically enclosed with

More information

St. MARTIN S ENGINEERING COLLEGE Dhulapally, Secunderabad

St. MARTIN S ENGINEERING COLLEGE Dhulapally, Secunderabad St. MARTIN S ENGINEERING COLLEGE Dhulapally, Secunderabad-00 014 Subject: PPL Class : CSE III 1 P a g e DEPARTMENT COMPUTER SCIENCE AND ENGINEERING S No QUESTION Blooms Course taxonomy level Outcomes UNIT-I

More information

CSCE 314 Programming Languages. Type System

CSCE 314 Programming Languages. Type System CSCE 314 Programming Languages Type System Dr. Hyunyoung Lee 1 Names Names refer to different kinds of entities in programs, such as variables, functions, classes, templates, modules,.... Names can be

More information

Review of the C Programming Language

Review of the C Programming Language Review of the C Programming Language Prof. James L. Frankel Harvard University Version of 11:55 AM 22-Apr-2018 Copyright 2018, 2016, 2015 James L. Frankel. All rights reserved. Reference Manual for the

More information

Pierce Ch. 3, 8, 11, 15. Type Systems

Pierce Ch. 3, 8, 11, 15. Type Systems Pierce Ch. 3, 8, 11, 15 Type Systems Goals Define the simple language of expressions A small subset of Lisp, with minor modifications Define the type system of this language Mathematical definition using

More information

Chapter 7. Expressions and Assignment Statements

Chapter 7. Expressions and Assignment Statements Chapter 7 Expressions and Assignment Statements Chapter 7 Topics Introduction Arithmetic Expressions Overloaded Operators Type Conversions Relational and Boolean Expressions Short-Circuit Evaluation Assignment

More information

Programming Languages

Programming Languages Programming Languages Types CSCI-GA.2110-001 Summer 2011 What is a type? A type consists of a set of values The compiler/interpreter defines a mapping of these values onto the underlying hardware. 2 /

More information

Names, Bindings, Scopes

Names, Bindings, Scopes Names, Bindings, Scopes Variables In imperative l Language: abstractions of von Neumann machine Variables: abstraction of memory cell or cells Sometimes close to machine (e.g., integers), sometimes not

More information

4 Bindings and Scope. Bindings and environments. Scope, block structure, and visibility. Declarations. Blocks. 2004, D.A. Watt, University of Glasgow

4 Bindings and Scope. Bindings and environments. Scope, block structure, and visibility. Declarations. Blocks. 2004, D.A. Watt, University of Glasgow 4 Bindings and Scope Bindings and environments. Scope, block structure, and visibility. Declarations. Blocks. 2004, D.A. Watt, University of Glasgow 1 Bindings and environments PL expressions and commands

More information

CSE 307: Principles of Programming Languages

CSE 307: Principles of Programming Languages 1 / 57 CSE 307: Principles of Programming Languages Course Review R. Sekar Course Topics Introduction and History Syntax Values and types Names, Scopes and Bindings Variables and Constants Expressions

More information

G Programming Languages - Fall 2012

G Programming Languages - Fall 2012 G22.2110-003 Programming Languages - Fall 2012 Lecture 2 Thomas Wies New York University Review Last week Programming Languages Overview Syntax and Semantics Grammars and Regular Expressions High-level

More information

SE352b: Roadmap. SE352b Software Engineering Design Tools. W3: Programming Paradigms

SE352b: Roadmap. SE352b Software Engineering Design Tools. W3: Programming Paradigms SE352b Software Engineering Design Tools W3: Programming Paradigms Feb. 3, 2005 SE352b, ECE,UWO, Hamada Ghenniwa SE352b: Roadmap CASE Tools: Introduction System Programming Tools Programming Paradigms

More information

known as non-void functions/methods in C/C++/Java called from within an expression.

known as non-void functions/methods in C/C++/Java called from within an expression. FUNCTIONS 1 OUTLINE Basic Terminology Function Call and Return Parameters Parameter Passing Mechanisms Activation Records Recursive Functions Run Time Stack Function Declaration and Call in Clite Completing

More information

INSTITUTE OF AERONAUTICAL ENGINEERING

INSTITUTE OF AERONAUTICAL ENGINEERING INSTITUTE OF AERONAUTICAL ENGINEERING (Autonomous) Dundigal, Hyderabad -500 043 INFORMATION TECHNOLOGY TUTORIAL QUESTION BANK Name : PRINCIPLES OF PROGRAMMING LANGUAGES Code : A40511 Class : II B. Tech

More information

The role of semantic analysis in a compiler

The role of semantic analysis in a compiler Semantic Analysis Outline The role of semantic analysis in a compiler A laundry list of tasks Scope Static vs. Dynamic scoping Implementation: symbol tables Types Static analyses that detect type errors

More information

Chapter 7 Expressions and Assignment statements

Chapter 7 Expressions and Assignment statements Chapter 7 Expressions and Assignment statements 1 7.1 Introduction Expressions are the fundamental means of specifying computations in a programming language Semantics of expressions are discussed in this

More information

Introduction Primitive Data Types Character String Types User-Defined Ordinal Types Array Types. Record Types. Pointer and Reference Types

Introduction Primitive Data Types Character String Types User-Defined Ordinal Types Array Types. Record Types. Pointer and Reference Types Chapter 6 Topics WEEK E FOUR Data Types Introduction Primitive Data Types Character String Types User-Defined Ordinal Types Array Types Associative Arrays Record Types Union Types Pointer and Reference

More information

COMP 181. Agenda. Midterm topics. Today: type checking. Purpose of types. Type errors. Type checking

COMP 181. Agenda. Midterm topics. Today: type checking. Purpose of types. Type errors. Type checking Agenda COMP 181 Type checking October 21, 2009 Next week OOPSLA: Object-oriented Programming Systems Languages and Applications One of the top PL conferences Monday (Oct 26 th ) In-class midterm Review

More information

Chapter 3:: Names, Scopes, and Bindings (cont.)

Chapter 3:: Names, Scopes, and Bindings (cont.) Chapter 3:: Names, Scopes, and Bindings (cont.) Programming Language Pragmatics Michael L. Scott Review What is a regular expression? What is a context-free grammar? What is BNF? What is a derivation?

More information

COS 140: Foundations of Computer Science

COS 140: Foundations of Computer Science COS 140: Foundations of Computer Science Variables and Primitive Data Types Fall 2017 Introduction 3 What is a variable?......................................................... 3 Variable attributes..........................................................

More information

Chapter 5 Names, Bindings, Type Checking, and Scopes

Chapter 5 Names, Bindings, Type Checking, and Scopes Chapter 5 Names, Bindings, Type Checking, and Scopes 長庚大學資訊工程學系 陳仁暉 助理教授 Tel: (03) 211-8800 Ext: 5990 E-mail: jhchen@mail.cgu.edu.tw URL: http://www.csie.cgu.edu.tw/jhchen All rights reserved. No part

More information

CSE 431S Type Checking. Washington University Spring 2013

CSE 431S Type Checking. Washington University Spring 2013 CSE 431S Type Checking Washington University Spring 2013 Type Checking When are types checked? Statically at compile time Compiler does type checking during compilation Ideally eliminate runtime checks

More information

UNIT 3

UNIT 3 UNIT 3 Presentation Outline Sequence control with expressions Conditional Statements, Loops Exception Handling Subprogram definition and activation Simple and Recursive Subprogram Subprogram Environment

More information

Chapter 7:: Data Types. Mid-Term Test. Mid-Term Test (cont.) Administrative Notes

Chapter 7:: Data Types. Mid-Term Test. Mid-Term Test (cont.) Administrative Notes Chapter 7:: Data Types Programming Language Pragmatics Michael L. Scott Administrative Notes Mid-Term Test Thursday, July 27 2006 at 11:30am No lecture before or after the mid-term test You are responsible

More information

G Programming Languages - Fall 2012

G Programming Languages - Fall 2012 G22.2110-003 Programming Languages - Fall 2012 Lecture 4 Thomas Wies New York University Review Last week Control Structures Selection Loops Adding Invariants Outline Subprograms Calling Sequences Parameter

More information

CSE 452: Programming Languages. Outline of Today s Lecture. Expressions. Expressions and Control Flow

CSE 452: Programming Languages. Outline of Today s Lecture. Expressions. Expressions and Control Flow CSE 452: Programming Languages Expressions and Control Flow Outline of Today s Lecture Expressions and Assignment Statements Arithmetic Expressions Overloaded Operators Type Conversions Relational and

More information

Lecture 12: Data Types (and Some Leftover ML)

Lecture 12: Data Types (and Some Leftover ML) Lecture 12: Data Types (and Some Leftover ML) COMP 524 Programming Language Concepts Stephen Olivier March 3, 2009 Based on slides by A. Block, notes by N. Fisher, F. Hernandez-Campos, and D. Stotts Goals

More information

SEMANTIC ANALYSIS TYPES AND DECLARATIONS

SEMANTIC ANALYSIS TYPES AND DECLARATIONS SEMANTIC ANALYSIS CS 403: Type Checking Stefan D. Bruda Winter 2015 Parsing only verifies that the program consists of tokens arranged in a syntactically valid combination now we move to check whether

More information

Expressions and Assignment Statements

Expressions and Assignment Statements Expressions and Assignment Statements Introduction Expressions are the fundamental means of specifying computations in a programming language To understand expression evaluation, need to be familiar with

More information

1. true / false By a compiler we mean a program that translates to code that will run natively on some machine.

1. true / false By a compiler we mean a program that translates to code that will run natively on some machine. 1. true / false By a compiler we mean a program that translates to code that will run natively on some machine. 2. true / false ML can be compiled. 3. true / false FORTRAN can reasonably be considered

More information

Compilers. Type checking. Yannis Smaragdakis, U. Athens (original slides by Sam

Compilers. Type checking. Yannis Smaragdakis, U. Athens (original slides by Sam Compilers Type checking Yannis Smaragdakis, U. Athens (original slides by Sam Guyer@Tufts) Summary of parsing Parsing A solid foundation: context-free grammars A simple parser: LL(1) A more powerful parser:

More information

Programming Languages 2nd edition Tucker and Noonan"

Programming Languages 2nd edition Tucker and Noonan Programming Languages 2nd edition Tucker and Noonan" " Chapter 1" Overview" " A good programming language is a conceptual universe for thinking about programming. " " " " " " " " " " " " "A. Perlis" "

More information

NOTE: Answer ANY FOUR of the following 6 sections:

NOTE: Answer ANY FOUR of the following 6 sections: A-PDF MERGER DEMO Philadelphia University Lecturer: Dr. Nadia Y. Yousif Coordinator: Dr. Nadia Y. Yousif Internal Examiner: Dr. Raad Fadhel Examination Paper... Programming Languages Paradigms (750321)

More information

Chapter 3:: Names, Scopes, and Bindings (cont.)

Chapter 3:: Names, Scopes, and Bindings (cont.) Chapter 3:: Names, Scopes, and Bindings (cont.) Programming Language Pragmatics Michael L. Scott Review What is a regular expression? What is a context-free grammar? What is BNF? What is a derivation?

More information

Organization of Programming Languages CS320/520N. Lecture 06. Razvan C. Bunescu School of Electrical Engineering and Computer Science

Organization of Programming Languages CS320/520N. Lecture 06. Razvan C. Bunescu School of Electrical Engineering and Computer Science Organization of Programming Languages CS320/520N Razvan C. Bunescu School of Electrical Engineering and Computer Science bunescu@ohio.edu Data Types A data type defines a collection of data objects and

More information

Topics Covered Thus Far. CMSC 330: Organization of Programming Languages. Language Features Covered Thus Far. Programming Languages Revisited

Topics Covered Thus Far. CMSC 330: Organization of Programming Languages. Language Features Covered Thus Far. Programming Languages Revisited CMSC 330: Organization of Programming Languages Type Systems, Names & Binding Topics Covered Thus Far Programming languages Syntax specification Regular expressions Context free grammars Implementation

More information

CSc 520 Principles of Programming Languages. 26 : Control Structures Introduction

CSc 520 Principles of Programming Languages. 26 : Control Structures Introduction CSc 520 Principles of Programming Languages 26 : Control Structures Introduction Christian Collberg Department of Computer Science University of Arizona collberg+520@gmail.com Copyright c 2008 Christian

More information

The Compiler So Far. CSC 4181 Compiler Construction. Semantic Analysis. Beyond Syntax. Goals of a Semantic Analyzer.

The Compiler So Far. CSC 4181 Compiler Construction. Semantic Analysis. Beyond Syntax. Goals of a Semantic Analyzer. The Compiler So Far CSC 4181 Compiler Construction Scanner - Lexical analysis Detects inputs with illegal tokens e.g.: main 5 (); Parser - Syntactic analysis Detects inputs with ill-formed parse trees

More information

9/7/17. Outline. Name, Scope and Binding. Names. Introduction. Names (continued) Names (continued) In Text: Chapter 5

9/7/17. Outline. Name, Scope and Binding. Names. Introduction. Names (continued) Names (continued) In Text: Chapter 5 Outline Name, Scope and Binding In Text: Chapter 5 Names Variable Binding Type bindings, type conversion Storage bindings and lifetime Scope Lifetime vs. Scope Referencing Environments N. Meng, S. Arthur

More information

Types and Type Inference

Types and Type Inference CS 242 2012 Types and Type Inference Notes modified from John Mitchell and Kathleen Fisher Reading: Concepts in Programming Languages, Revised Chapter 6 - handout on Web!! Outline General discussion of

More information

CMSC 330: Organization of Programming Languages

CMSC 330: Organization of Programming Languages CMSC 330: Organization of Programming Languages Type Systems, Names and Binding CMSC 330 - Spring 2013 1 Topics Covered Thus Far! Programming languages Ruby OCaml! Syntax specification Regular expressions

More information

Introduction. A. Bellaachia Page: 1

Introduction. A. Bellaachia Page: 1 Introduction 1. Objectives... 2 2. Why are there so many programming languages?... 2 3. What makes a language successful?... 2 4. Programming Domains... 3 5. Language and Computer Architecture... 4 6.

More information

Weeks 6&7: Procedures and Parameter Passing

Weeks 6&7: Procedures and Parameter Passing CS320 Principles of Programming Languages Weeks 6&7: Procedures and Parameter Passing Jingke Li Portland State University Fall 2017 PSU CS320 Fall 17 Weeks 6&7: Procedures and Parameter Passing 1 / 45

More information

Lecture 7: Type Systems and Symbol Tables. CS 540 George Mason University

Lecture 7: Type Systems and Symbol Tables. CS 540 George Mason University Lecture 7: Type Systems and Symbol Tables CS 540 George Mason University Static Analysis Compilers examine code to find semantic problems. Easy: undeclared variables, tag matching Difficult: preventing

More information

CS558 Programming Languages. Winter 2013 Lecture 3

CS558 Programming Languages. Winter 2013 Lecture 3 CS558 Programming Languages Winter 2013 Lecture 3 1 NAMES AND BINDING One essential part of being a high-level language is having convenient names for things: variables constants types functions etc. classes

More information

Expression Evaluation and Control Flow. Outline

Expression Evaluation and Control Flow. Outline Expression Evaluation and Control Flow In Text: Chapter 6 Outline Notation Operator Evaluation Order Operand Evaluation Order Overloaded operators Type conversions Short-circuit evaluation of conditions

More information

Programming Languages & Paradigms PROP HT Course Council. Subprograms. Meeting on friday! Subprograms, abstractions, encapsulation, ADT

Programming Languages & Paradigms PROP HT Course Council. Subprograms. Meeting on friday! Subprograms, abstractions, encapsulation, ADT Programming Languages & Paradigms PROP HT 2011 Lecture 4 Subprograms, abstractions, encapsulation, ADT Beatrice Åkerblom beatrice@dsv.su.se Course Council Meeting on friday! Talk to them and tell them

More information

Attributes, Bindings, and Semantic Functions Declarations, Blocks, Scope, and the Symbol Table Name Resolution and Overloading Allocation, Lifetimes,

Attributes, Bindings, and Semantic Functions Declarations, Blocks, Scope, and the Symbol Table Name Resolution and Overloading Allocation, Lifetimes, Chapter 5 Basic Semantics Attributes, Bindings, and Semantic Functions Declarations, Blocks, Scope, and the Symbol Table Name Resolution and Overloading Allocation, Lifetimes, and the Environment Variables

More information

Fundamentals of Programming Languages

Fundamentals of Programming Languages Fundamentals of Programming Languages 1. DEFINITIONS... 2 2. BUILT-IN TYPES AND PRIMITIVE TYPES... 3 TYPE COMPATIBILITY... 9 GENERIC TYPES... 14 MONOMORPHIC VERSUS POLYMORPHIC... 16 TYPE IMPLEMENTATION

More information

Lecture Overview. [Scott, chapter 7] [Sebesta, chapter 6]

Lecture Overview. [Scott, chapter 7] [Sebesta, chapter 6] 1 Lecture Overview Types 1. Type systems 2. How to think about types 3. The classification of types 4. Type equivalence structural equivalence name equivalence 5. Type compatibility 6. Type inference [Scott,

More information

EI326 ENGINEERING PRACTICE & TECHNICAL INNOVATION (III-G) Kenny Q. Zhu Dept. of Computer Science Shanghai Jiao Tong University

EI326 ENGINEERING PRACTICE & TECHNICAL INNOVATION (III-G) Kenny Q. Zhu Dept. of Computer Science Shanghai Jiao Tong University EI326 ENGINEERING PRACTICE & TECHNICAL INNOVATION (III-G) Kenny Q. Zhu Dept. of Computer Science Shanghai Jiao Tong University KENNY ZHU Research Interests: Programming Languages Data processing Coordination

More information

CPS 506 Comparative Programming Languages. Programming Language

CPS 506 Comparative Programming Languages. Programming Language CPS 506 Comparative Programming Languages Object-Oriented Oriented Programming Language Paradigm Introduction Topics Object-Oriented Programming Design Issues for Object-Oriented Oriented Languages Support

More information

LECTURE 14. Names, Scopes, and Bindings: Scopes

LECTURE 14. Names, Scopes, and Bindings: Scopes LECTURE 14 Names, Scopes, and Bindings: Scopes SCOPE The scope of a binding is the textual region of a program in which a name-to-object binding is active. Nonspecifically, scope is a program region of

More information

Programming Languages

Programming Languages Programming Languages Types CSCI-GA.2110-003 Fall 2011 What is a type? An interpretation of numbers Consists of a set of values The compiler/interpreter defines a mapping of these values onto the underlying

More information

COS 140: Foundations of Computer Science

COS 140: Foundations of Computer Science COS 140: Foundations of Variables and Primitive Data Types Fall 2017 Copyright c 2002 2017 UMaine School of Computing and Information S 1 / 29 Homework Reading: Chapter 16 Homework: Exercises at end of

More information

Programming Languages Third Edition. Chapter 10 Control II Procedures and Environments

Programming Languages Third Edition. Chapter 10 Control II Procedures and Environments Programming Languages Third Edition Chapter 10 Control II Procedures and Environments Objectives Understand the nature of procedure definition and activation Understand procedure semantics Learn parameter-passing

More information

Fundamentals of Programming Languages. Data Types Lecture 07 sl. dr. ing. Ciprian-Bogdan Chirila

Fundamentals of Programming Languages. Data Types Lecture 07 sl. dr. ing. Ciprian-Bogdan Chirila Fundamentals of Programming Languages Data Types Lecture 07 sl. dr. ing. Ciprian-Bogdan Chirila Predefined types Programmer defined types Scalar types Structured data types Cartesian product Finite projection

More information

22c:111 Programming Language Concepts. Fall Functions

22c:111 Programming Language Concepts. Fall Functions 22c:111 Programming Language Concepts Fall 2008 Functions Copyright 2007-08, The McGraw-Hill Company and Cesare Tinelli. These notes were originally developed by Allen Tucker, Robert Noonan and modified

More information