Chapter 9
Subprograms
Introduction
Two fundamental abstraction facilities
Process abstraction (this chapter): Emphasized
from early days
Data abstraction (Chapter 11): Emphasized in
the1980s
2
Fundamentals of Subprograms
General characteristics of subprog
Chapter 6
Data Types
1
Introduction
A data type defines a collection of data
objects and a set of predefined operations
on those objects
Evolution of data types:
FORTRAN I (1957)  INTEGER, REAL, arrays
Ada (1983)  User can create a unique type for
every
Chapter 10
Implementing Subprograms
Subprogram linkage
The subprogram call and return are called
subprogram linkage
The format and the layout of the noncode
part of a subprogram is called activation
record
An activation record instance: a concrete
example
Chapter 7
Expressions and
Assignment Statements
1
Introduction
Expressions are the fundamental means of
specifying computations in a programming
language.
To understand expression evaluation, one
needs to be familiar with the orders of
operator and operan
Chapter 1
Preliminaries
Chapter 1 Topics
Motivation: Reasons for studying Programming
Languages
Programming Domains
Language Evaluation Criteria
Influences on Language Design
Language Categories
Language Design TradeOffs
Implementation Methods
Programmin
Chapter 3
Describing Syntax and Semantics
Chapter 3 Topics
Introduction
The General Problem of Describing
Syntax
Formal Methods of Describing Syntax
Attribute Grammars
2
Introduction
Who needs a language definition/description?
Other language designers an
Chapter 4
Lexical and Syntax Analysis
1
Introduction
Compilation is typically used for large applications.
Pure interpretation is used for smaller applications
for which the execution efficiency and memory
requirements are not critical. Many serverside
a
Chapter 8
StatementLevel
Control Structures
1
Introduction
In addition to expressions and assignment statements,
a language must provide linguistic mechanisms for
selecting among alternative control flow paths and for
repeated execution of statement sequ
Chapter 5
Names, Bindings, Type
Checking, and Scopes
1
Introduction
Imperative languages are abstractions of von
Neumann architecture. Two primary components:
Memory
Processor
The central future of imperative languages are:
variables, assignment statement
CSC388 Online Programming Languages
Study Guide for the Final Exam
The final will be given during finals week, December 14th 18th. It will last 1 hour and 40 minutes. The
exam must be taken in one sitting. The exam will include 10 questions and 4 problems
/*
* This class illustrates creating a class using
* a generic type. T will be replaced with an actual
* type when this class is instantiated in main()
*
* @author Lorrie Lehmann
* @version August 30, 2015
*/
public class GenericData<T>
cfw_
private T any
/*
* This class uses another class that has a generic type.
* In each instantiation of the class named GenericData I send in
* a different type to replace the placeholder in the class,
* An actual type is given to replace the
* T in the other class. Notic
FUSION FS HADOOP
IMPROVING HADOOP THROUGH FUSION FS
Alekya thalari, Krishnaja Kethireddy, Nirmal Kumar Ravi and Prathamesh Mantri
cfw_athalari,kkethire,nravi,pmantri2@hawk.iit.edu
Department of Computer Science
Illinois Institute of Technology
Chicago, IL
CS 173, Spring 2009 Homework 6 Solution
Total point value: 50 points.
1. Recursive denition of a set [10 points] (a) Dene the set S Z2 as follows: rule 1: rule 2: rule 3: rule 4: (0, 0) S (10, 0) S If (x, y) S, then (y, x) S If (x, y) S, then (x, y) S
Wha
CS 173, Spring 2009 Homework 4 Solutions
(Total point value: 54 points.)
1. Functions [6 points] For each of the following functions, state whether or not they are onetoone and whether or not they are onto. (a) f : R R such that f (x) = x onetoone: no
CS 173, Spring 2009 Homework 3 Solutions (Total point value: 50 points.)
1. Euclidean algorithm [4 points] Trace the execution of the Euclidean algorithm (lecture 9, p 229 in Rosen) on the inputs 1224 and 850. That is, give a table showing the values of t
CS 173, Spring 2009 Homework 1 Solutions
1. [9 points] Translate the following sentences into propositional logic, making the meaning of your propositional variables clear. See page 11 of the textbook for some examples of translating English sentences int
CS 173, Spring 2009 Homework 5 Solutions (Total point value: 50 points.)
1. Recursive denition [10 points] (a) Consider the function h dened by the following recursive denition. Compute h(x) for x from 0 to 10. h(0) = 0 h(1) = 1 h(2) = 1 h(n) = h(n 1) + h
CS 173: Discrete Mathematical Structures, Spring 2009 Homework 9 Solutions
1. [10 points] Pigeonhole Principle Let S be a set of ten distinct integers between 1 and 50. (Distinct means that no two elements of S are the same.) Use the pigeonhole principle
CS 173, Spring 2009 Homework 8 Solutions (Total point value: 50 points.)
1. Counting I [10 points] For the following four questions, you do not need to multiply out factorials to reach a nal answer. For example, P (10, 4) = 10! would be acceptable as an 6
CS 173: Discrete Mathematical Structures, Spring 2009 Homework 11 Solutions
1. [10 points] Proving an operation welldened Suppose that A = R2 cfw_(0, 0), i.e A is 2D space minus the origin. We can dene an equivalence relation on A as follows: (x, y) (p,
CS 173, Spring 2009 Homework 7 Solutions (Total point value: 30 points.)
1. Induction with inequalities [10 points] Use induction to show that the following holds for all integers n 8. n2 > 7n + 1 Solution: Base case: Note that the base case here occurs w
Inheritance Two (Part 8)
Final Example
 Let's put dynamic binding to work with our original vehicle example
 In our previous example, the correct computeDuration method was not being called
 We now know that for this to occur, we need to make this func
Inheritance Two (Part 7)
 Note how the method display is declared to be virtual
 Note how dynamic binding works with the base class pointers (m[0] and m[1])
 They correctly call the method of the type of object they are pointing to
 A derived class de
Standard Template Library (Part 8)
STL and User classes
 We can use our own classes with STL container classes
 Consider the example below
#include <iostream>
#include <list>
using namespace std;
class Test
cfw_
friend ostream &operator<( ostream &strm,
Standard Template Library (Part 7)
Algorithms
 Another very useful feature of the STL is the inclusion of robust algorithms
 These algorithms process elements in collections
 Algorithms are NOT member functions of container classes
 Rather, they are i
Standard Template Library (Part 6)
Iterators
 The STL includes special class objects to "iterate" or navigate over elements in a list
 Similar to pointers, iterators "point to" elements in a list
 Iterators represent positions of elements within a list
Standard Template Library (Part 5)
More on Containers
 All containers have several common operations implemented as methods
 Some of these common methods include:
size()
Returns the actual number of elements in the container
empty()
Returns whether the
Standard Template Library (Part 4)
list
 STL container implementing behavior of a linked list
 Contains references to the next and previous element in the list (doubly linked list)
 Manages elements in a dynamic array (size not known until runtime)
