Little Quilt Programming Language. 2 A Little language of expressions Little Quilt The little language ----Little Quilt: quilts: Constructs in Little.

Slides:



Advertisements
Similar presentations
Specifying Languages Our aim is to be able to specify languages for use in the computer. The sketch of the FSA is easy for us to understand, but difficult.
Advertisements

A Third Look At ML 1. Outline More pattern matching Function values and anonymous functions Higher-order functions and currying Predefined higher-order.
Principles of programming languages 1: Introduction (with a simple language) Isao Sasano Department of Information Science and Engineering.
Translator Architecture Code Generator ParserTokenizer string of characters (source code) string of tokens abstract program string of integers (object.
ENS 207 engineering graphics
Quilting Vs. Patchwork H276 Ms. Haushalter. What is Quilting? Quilting: is the together of two layers of fabric and an in- between layer of padding with.
1. Frequency Distribution & Relative Frequency Distribution 2. Histogram of Probability Distribution 3. Probability of an Event in Histogram 4. Random.
SECTION 2-3 Mathematical Modeling – Triangular Numbers HW: Investigate Pascal’s Triangle o Write out the first 8 rows o Identify the linear, rectangular.
Principles of programming languages 4: Parameter passing, Scope rules Department of Information Science and Engineering Isao Sasano.
Goal: to rotate a figure around a central point
Chapter TenModern Programming Languages1 Scope. Chapter TenModern Programming Languages2 Reusing Names n Scope is trivial if you have a unique name for.
Scope Chapter Ten Modern Programming Languages.
Scope Chapter TenModern Programming Languages, 2nd ed.1.
Picture Manipulation The manipulation of (already created) pictures. May be applied to vector graphics or bitmaps. We will consider bitmaps and introduce.
Mathematics. Matrices and Determinants-1 Session.
ML: a quasi-functional language with strong typing Conventional syntax: - val x = 5; (*user input *) val x = 5: int (*system response*) - fun len lis =
1 Relational Algebra and Calculus Yanlei Diao UMass Amherst Feb 1, 2007 Slides Courtesy of R. Ramakrishnan and J. Gehrke.
Basic geometric FIGURES
Recall that a square matrix is one in which there are the same amount of rows as columns. A square matrix must exist in order to evaluate a determinant.
L ECTURE 2 Chapter 3 Recursive Definitions. R ECURSIVE D EFINITION It is method of defining sets.
Introduction and Chapter 8 of Programming Languages by Ravi Sethi Elements of Functional Programming.
Functional Programming Element of Functional Programming.
12.2: Analyze Arithmetic Sequences and Series HW: p (4, 10, 12, 14, 24, 26, 30, 34)
Md.Kausher ahmed Electrical department. Advanced electricity Code-6722.
6.3 Factoring Trinomials and Perfect Square Trinomial BobsMathClass.Com Copyright © 2010 All Rights Reserved Write all possible pairs of factors.
Algebra-2 Section 1-3 And Section 1-4. Quiz Simplify 1. Simplify -4y – x + 10x + y 2. Is x = -2 a solution to following equation? 3. Solve.
1 Chapter Construction Techniques. 2 Section 3.3 Grammars A grammar is a finite set of rules, called productions, that are used to describe the.
Geometry Grade 4 CONFIDENTIAL.
Section 5.2: Definite Integrals
PRE-ALGEBRA. Lesson 4-8 Warm-Up PRE-ALGEBRA How do you divide powers with the same base? Rule: When you divide numbers with the same base, subtract the.
Chapter Nine Section Three Multiplying a Polynomial by a Monomial.
Pre-Algebra Patterns and Sequences What is the common difference in the sequence –6, –3, 0, 3,... ? Lesson 13-1 The common difference is 3. –6 –
1 Relational Algebra and Calculas Chapter 4, Part A.
1 Module 14 Regular languages –Inductive definitions –Regular expressions syntax semantics.
1 5.2 – The Definite Integral. 2 Review Evaluate.
A Second Look At ML 1. Outline Patterns Local variable definitions A sorting example 2.
A Third Look At ML Chapter NineModern Programming Languages, 2nd ed.1.
SECTION 2-3 Mathematical Modeling. When you draw graphs or pictures of situation or when you write equations that describe a problem, you are creating.
Transformations on the Coordinate Plane: Translations and Rotations.
Step One Draw a square on your paper. Step Two Beginning in the top left corner of the square, measure to the right about a half inch and place a dot.
Rotation – A circular movement around a fixed point Rotation.
Rotations on the Coordinate Plane. Horizontal- left and right.
5.2 Definite Integrals. When we find the area under a curve by adding rectangles, the answer is called a Riemann sum. subinterval partition The width.
Recursive Definations Regular Expressions Ch # 4 by Cohen
Elements of Art. ELEMENTS OF ART KIM Elements of Art The different parts that make up any piece of art.
Bell Quiz. Objectives Learn to simplify expressions by using three new properties for exponents: – The Power of a Power Property – The Power of a Product.
Geometric Proof of the Sum of Squares by Christina Martin Math 310, Fall 2012 a2a2 + b 2 = c 2 a2a2 a2a2 b2b2 b2b2.
12.2, 12.3: Analyze Arithmetic and Geometric Sequences HW: p (4, 10, 12, 18, 24, 36, 50) p (12, 16, 24, 28, 36, 42, 60)
Lesson 5-2 The Definite Integral. Ice Breaker See handout questions 1 and 2.
Describing Objects Practice Activity. Do the following 1.With a partner or small group, take turns describing the objects on the following pages. 2.Make.
Recursive Definitions and Regular Expression RD -- A method of defining sets RE -- A concise way of expressing a pattern in a language.
Algebra-2 Section 1-3 And Section 1-4. Quiz Simplify using “step-by-step” (provide a reason or justification for each step). -4y – x + 10x + y.
Programming Languages Dan Grossman 2013 ML Expressions and Variable Bindings.
4.3: Definite Integrals Learning Goals Express the area under a curve as a definite integral and as limit of Riemann sums Compute the exact area under.
Definite Integrals, The Fundamental Theorem of Calculus Parts 1 and 2 And the Mean Value Theorem for Integrals.
Write an expression which represents the perimeter of the rectangle?
Warm-up: Add 6 sticks to make 10. No breaking!
Ramayana Mind Maps What Are Mind Maps?.
Information Science and Engineering
Formal Language & Automata Theory
Section 6. 3 Area and the Definite Integral Section 6
5 Construction 6 Division of a Line Segment into Three Equal Segments, Without Measuring From point A (or B), draw a ray at an acute angle to the given.
Specifying Languages Our aim is to be able to specify languages for use in the computer. The sketch of the FSA is easy for us to understand, but difficult.
Differentiate. f (x) = x 3e x
Gates Type AND denoted by X.Y OR denoted by X + Y NOR denoted by X + Y
1. Turn to a piece of graph paper in your module packet. 2. Make three graphs for number one. 3. In each graph draw the triangle.
Two Dimensional Geometrical Shapes
Expanding two brackets
13 Chapter Congruence and Similarity with Transformations
Combine Like Terms Notes Page 23
Presentation transcript:

Little Quilt Programming Language

2 A Little language of expressions Little Quilt The little language ----Little Quilt: quilts: Constructs in Little Quilt are expressions denoting geometric objects called quilts: Quilts made up of simpler pieces

3 A Little language of expressions What Does Little Quilt Manipulate? Little Quilt manipulates geometric objects with height, width and texture Basic Value and Operations: The two primitive objects in the language are the square piece.

4 Operations on quilts The operations are specified by the following rules: A quilt is one of the primitive pieces, or It is formed by turning a quilt clockwise 90°, or it is formed by sewing a quilt to the right of another quilt of equal height. Nothing else is a quilt.

5 Operations on quilts

6 Syntax of expressions denoting quilts Constants: ab Names for basic values: the pieces be called a and b turnsew Names of operations: the operations be called turn and sew. (like the picture on the previous slide) now that we have chosen the built-in object and operations (a, b, turn, sew) expressions can be formed ::= a | b | turn( ) | sew (, )

7 An example Sew (turn (turn (b) ), a)

8 User-Defined Functions Some of the frequent operations are not provided directly by Little Quilt. These operations can be programmed by using a combination of turning and sewing.

9 User-Defined Functions Examples: unturn: turning a quilt counterclockwise 90° fun unturn(x) = turn( turn( turn(x) ) ) Pile: attaching one quilt above another of same width fun pile(x,y) = unturn( sew( turn(y),turn(x) ) )

10 Local Declarations Let-expressions or let-bindings allow declarations to appear with expressions. The form is: let in end

11 Local Declarations Example: let fun unturn(x) = turn( turn( turn(x))) fun pile(x,y) = unturn( sew( turn(y),turn(x) ) ) in pile (unturn(b), turn(b)) end

12 User-Defined Names for Values To write large expressions in terms of simpler ones. A value declaration gives a name to a value val = Value declarations are used together with let- bindings. let val x=E1 in E2 end occurrences of name x in E2 represent the value of E1

13 What is the result of pile? Let fun unturn(x) = turn( turn( turn(x) ) ) fun pile (x,y) = unturn( sew( turn(y), turn(x) ) ) val aa = pile(a, trun( turn(a) ) ) val bb = pile( unturn(b), turn(b) ) val p = sew(bb, aa) val q = sew(aa, bb) in pile(p,q) end b a Four straight parallel diagonals Four curved equidistant lines

14 Pile(p,q) bb aa sew aabb pile p q

15 Quiz!