11/22/2010
Lecture 12 LETREC
T. METIN SEZGIN NOV 16 2009
PROC is ex; long live LETREC
PROC had its limitations
No recursive procedures Specification
Define a language with recursive procedures
Syntax Semantics
Representation Implementation
LETREC
T
11/22/2010
Lecture 12 LETREC
T. METIN SEZGIN NOV 10 2010
PROC is ex; long live LETREC
PROC had its limitations
No recursive procedures Specification
Define a language with recursive procedures
Syntax Semantics
Representation Implementation
LETREC
T
11/8/2010
Lecture 11 PROC
T. METIN SEZGIN NOV 8 2010
LET is ex; long live PROC
LET had its limitations
No procedures Specification
Define a language with procedures
Syntax Semantics
Representation Implementation
Expressed and Denoted values
Before
11/8/2010
Lecture 10 Let Implementation
T. METIN SEZGIN NOV 2 2010
LET: our pet language
An example program
Input Scanning & parsing The AST Syntax Values
Components of the language
Environment Behavior specification Behavior implementation
Scanning P
10/27/2010
Lecture 8 Expressions
T. METIN SEZGIN OCT 27 2010
The next few weeks
Expressions Binding of variables Scoping of variables Environment Interpreters
Notation
Assertions for specification
The big picture interpreter
Use rules from earlier chap
10/27/2010
Lecture 7 Abstract Syntax and Its Representation
T. METIN SEZGIN OCT 25 2010
Syntax
Human vs. the computer
Lambda calculus
A specific example
Alternative syntax
The computer
Parsing expressions
Unparsing
1
10/27/2010
Parsers, parser generato
10/19/2010
Lecture 6 Interfaces and Tools for Defining Recursive Data Types
T. METIN SEZGIN OCT 20 2010
Defining Sets Using Grammars
Components of a grammar Terminals Non-terminals (syntactic categories) Productions (no context) Optional bits Naming conv
10/19/2010
Lecture 5
Representation Strategies for Data Types
T. METIN SEZGIN OCT 18 2010
Representation strategies
Two strategies Data Structure Representation Procedural Representation Test case Environment
Function that maps
variables to values List,
10/19/2010
Lecture 3 Recursive Procedures & Auxiliary Procedures
T. METIN SEZGIN OCT 11 2010
How do we go about the implementation?
How do we go about the implementation?
The grammar
What do we do with occurs-free?
What good is it? Any ideas of sample s
10/19/2010
Lecture 3 Recursive Procedures & Auxiliary Procedures
T. METIN SEZGIN OCT 11 2010
Variables
Implement occurs-free?
Such that
The rules of occurs-free?
How do we go about the implementation?
How do we go about the implementation?
The grammar
Comp201: Discrete Computational Structures Fall Term, 2010
Homework 4: Solutions
1
Answers for Section 8.1
8.1.56 We prove this by induction on n. It is very easy to show that this is true for the base case n = 1, since R1 = R and R is symmetric. At the i
Comp201: Discrete Computational Structures Fall Term, 2010
Homework 3: Solutions
1
Answers for Section 3.7
3.7.10 We will use proof by contradiction and assume that x is an inverse of a modulo m, i.e., ax 1 (mod m). Then by denition of modular congruence,
Comp201: Discrete Computational Structures Fall Term, 2010
Homework 2: Solutions
1
Answers for Section 3.1
3.1.28 This could be thought of as just doing two iterations of binary search at once. We compare the sought-after element to the middle element in
COMP 201, Fall 2010 HW1 SOLUTIONS 1.1/42 No, because it cannot have a truth value. Indeed, this statement causes a paradox. Let's assume that it is true. Then, it is asserting that it is false, which is a contradiction. Let's assume that it is false. Then
/*THIS CODE IS MY OWN WORK. I DID NOT CONSULT TO ANY PROGRAM WRITTEN BY OTHER STUDENTS. I READ AND FOLLOWED THE GUIDELINE GIVEN IN THE PROGRAMMING ASSIGNMENT. NAME: ERCAN YILMAZ */ package comp202; import java.util.ArrayList; import java.util.Comparator;