Procedures vs. Functions. Procedure Call. Syntax. Activation Record for Nested Blocks. Environment. CSE 3302 Programming Languages
|
|
- Marshall Lawrence
- 6 years ago
- Views:
Transcription
1 -2-3 CSE 3302 Progrmmng Lnguges Control II Procedures nd Envronments Chengk L, Wemn He Sprng Procedures vs. Functons Functon: no sde effect return vlue Functon cll: epresson Procedure: sde effect, eecuted for t no return vlue Procedure cll: sttement No cler dstncton mde n most lnguges C/C++: vod Ad/FORTRAN/Pscl: procedure/functon Chengk L, Wemn He, Chengk L, Wemn He, 2 Snt Procedure Cll Termnolog: od specfcton nterfce nme tpe of return vlue prmeters (nmes nd tpes) nt f(nt ) nt ; =+; return ; nt f(nt ); //declrton nt f(nt ) //defnton nt ; =+; return ; Cller: Cllee: nt f(nt ) f(); nt ; f (==0) =+; return ; Control trnsferred from cller to cllee, t procedure cll Trnsferred ck to cller when eecuton reches the end of od Cn return erl Chengk L, Wemn He, 3 Chengk L, Wemn He, 4 sttc(glol) re stck Envronment Envronment: ndng from nmes to ther ttrutes (unllocted) hep utomtcll-llocted spces (locl vrles, procedures (chpter 8) under the control of runtme sstem oth for dnmc ndng mnull-llocted spces under the control of progrmmer Actvton Record for Nested Blocks Actvton record: memor llocted for the locl ojects of lock Enterng lock: ctvton record llocted Et from nner lock to surroundng lock: ctvton record relesed nt ; //glol nt,; = *0; nt ; = /2; Chengk L, Wemn He, 5 Chengk L, Wemn He, 6
2 -2-3 Actvton Record for Nested Blocks nt ; //glol nt,; = *0; nt ; = /2; X: Nonlocl vrle, n the surroundng ctvton record nt ; //glol vod B(vod) nt ; = /2; vod A(vod) nt,; = *0; Actvton Record Chengk L, Wemn He, 7 Chengk L, Wemn He, 8 nt ; //glol vod B(vod) nt ; = /2; vod A(vod) nt,; = *0; Actvton Record : glol vrle n defnng envronment Need to retn nformton n cllng envronment nt ; //glol vod B(vod) nt ; = /2; vod A(vod) nt,; = *0; Actvton Record : locl vrle n clled envronment : glol vrle n defnng envronment,: locl vrle n cllng envronment Chengk L, Wemn He, 9 Chengk L, Wemn He, 0 nt ; //glol vod B(vod) nt ; = /2; vod A(vod) nt,; = *0; Actvton Record Cn onl ccess glol vrles n defnng envronment No drect ccess to the locl vrles n the cllng envronment (Need to communcte through prmeters) Chengk L, Wemn He, Cller: Procedure Cll Cllee: nt f(nt ) f();...;...;...; ctul prmeter / rgument forml prmeter / rgument Prmeter Pssng Mechnsms: When nd how to evlute prmeters How ctul prmeter vlues re pssed to forml prmeters How forml prmeter vlues re pssed ck to ctul prmeters Chengk L, Wemn He, 2 2
3 -2-3 Prmeter Pssng Mechnsms Emple Pss/Cll Vlue Pss/Cll Reference Pss/Cll Vlue-Result Pss/Cll Nme Wht s the result? vod swp(nt, nt ) nt temp; temp = ; = ; = temp; nt =, j=2; swp(,j); prntf( =%d, j=%d\n,, j); It depends Chengk L, Wemn He, 3 Chengk L, Wemn He, 4 Pss Vlue Emple: Pss B Vlue Cller: Cllee: nt f(nt ) f();...; Most common one Replce forml prmeters the vlues of ctul prmeters Actul prmeters: No chnge Forml prmeters: Locl vrles (C, C++, Jv, Pscl) vod swp(nt, nt ) nt temp; temp = ; = ; = temp; nt =, j=2; swp(,j); prntf( =%d, j=%d\n,, j); 2 2 Chengk L, Wemn He, 5 Chengk L, Wemn He, 6 Are these Pss--Vlue? vod f(nt *p) *p = 0; vod f(nt []) [0]=0; 0 Jv: vod f(vector v) v.removeall(); Pss--Vlue: Ponters vod f(nt *p) *p = 0; nt *q; q = (nt *) mlloc(szeof(nt)); *q = ; prntf("%d\n", q[0]); q q? q q p p? Yes! q 0 p Chengk L, Wemn He, 7 Chengk L, Wemn He, 8 3
4 -2-3 Pss--Vlue: Ponters vod f(nt *p) p = (nt *) mlloc(szeof(nt)); *p = 0; nt *q; q = (nt *) mlloc(szeof(nt)); *q = ; prntf("%d\n", q[0]); Pss--Vlue: Arrs vod f(nt p[]) p[0] = 0; nt q[0]; q[0]=; prntf("%d\n", q[0]); Chengk L, Wemn He, 9 Chengk L, Wemn He, 20 Pss--Vlue: Arrs vod f(nt p[]) p=(nt *) mlloc(szeof(nt)); p[0] = 0; nt q[0]; q[0]=; prntf("%d\n", q[0]); Pss--Vlue: Jv Ojects Jv: vod f(vector v) v.removeall(); Vector vec; vec.ddelement(new Integer()); f(vec); Sstem.out.prntln(vec.sze()); Chengk L, Wemn He, 2 Chengk L, Wemn He, 22 Pss--Vlue: Jv Ojects Pss Reference Jv: vod f(vector v) v = new Vector(); v.removeall(); Vector vec; vec.ddelement(new Integer()); f(vec); Sstem.out.prntln(vec.sze()); Chengk L, Wemn He, 23 Cller: Cllee: nt f(nt ) f();...; Forml prmeters ecome ls of ctul prmeters Actul prmeters: chnged chnges to forml prmeters Emples: Fortrn: the onl prmeter pssng mechnsm C++ (reference tpe, &) /Pscl (vr) Chengk L, Wemn He, 24 4
5 -2-3 Emple: Pss B Reference C++ snt. Not vld n C vod swp(nt &, nt &) nt temp; temp = ; = ; = temp; nt =, j=2; swp(,j); prntf( =%d, j=%d\n,, j); 2 j Pss--Reference: How to mnc t n C? vod f(nt *p) *p = 0; nt q; q = ; f(&q); prntf( %d\n, q); It s rell pss--vlue. Wh? Chengk L, Wemn He, 25 Chengk L, Wemn He, 26 It s rell pss--vlue vod f(nt *p) p = (nt *) mlloc(szeof(nt)); *p = 0; nt q; q = ; f(&q); prntf( %d\n, q); Pss--Reference: C++ Constnt Reference vod f(const nt & p) nt = p; p = 0; nt q; q = ; prntf("%d\n", q); Chengk L, Wemn He, 27 Chengk L, Wemn He, 28 Pss--Reference: C++ Reference-to-Ponter vod f(nt * &p) *p = 0; nt *q; nt [0]; [0]=; q=; prntf("%d, %d\n", q[0], [0]); Pss--Reference: C++ Reference-to-Ponter vod f(nt * &p) p = new nt; *p = 0; nt *q; nt [0]; [0]=; q=; prntf("%d, %d\n", q[0], [0]); Chengk L, Wemn He, 29 Chengk L, Wemn He, 30 5
6 -2-3 Pss--Reference: C++ Reference-to-Arr vod f(nt (&p)[0]) p[0]=0; nt *q; nt [0]; [0]=; q = ; f(); prntf("%d, %d\n", q[0], [0]); Pss Vlue-Result Cller: Cllee: nt f(nt ) f();...; Comnton of Pss--Vlue nd Pss--Reference (Pss--Reference wthout lsng) Replce forml prmeters the vlues of ctul prmeters Vlue of forml prmeters re coped ck to ctul prmeters Chengk L, Wemn He, 3 Chengk L, Wemn He, 32 Emple: Pss B Vlue-Result Unspecfed Issues vod swp(nt, nt ) nt temp; temp = ; = ; = temp; nt =, j=2; swp(,j); prntf( =%d, j=%d\n,, j); vod f(nt, nt ) = ; = 2; nt =0; f(,); prntf( =%d\n, ); 0 0? 2 j Chengk L, Wemn He, 33 Chengk L, Wemn He, 34 Pss Nme Emple: Pss B Nme Cller: Cllee: nt f(nt ) f();...; Actul prmeters onl evluted when the re needed The sme prmeter cn e evluted multple tmes Evluted n cllng envronment Essentll equvlent to norml order evluton Emple: Algol 60 Not dopted n mjor lnguges due to mplementton dffcult Chengk L, Wemn He, 35 vod swp(nt, nt ) nt temp; () temp = ; = ; = temp; nt =, j=2; () swp(,j); prntf( =%d, j=%d\n,, j); (j) 2 () 2 (j) 2 Chengk L, Wemn He, temp temp temp 36 6
7 -2-3 Pss--Nme: Sde Effects nt p[3]=,2,3; nt ; vod swp(nt, nt ) nt temp; temp = ; = ; = temp; = ; swp(, []); prntf( %d, %d\n,, []); Chengk L, Wemn He, 37 Some Vrnts Pss Nme Evluted t ever use, n the cllng envronment Pss Need Evluted once, memorzed for future use Pss Tet (Mcro) Evluted usng the clled envronment. All elong to Non-strct evluton (lz evluton) Chengk L, Wemn He, 38 Comprsons Cll Vlue Effcent. No ddtonl level of ndrecton. Less flele nd less effcent wthout ponter. (rr, struct, unon s prmeters) Cll Reference Requre one ddtonl level of ndrecton (eplct dereferencng) If prmeter s not vrle (e.g., constnt), memor spce must e llocted for t, n order to get reference. Esest to mplement. Cll Vlue-Result You m not wnt to chnge ctul prmeter vlues when fcng eceptons. Cll Nme Lz evluton Dffcult to mplement Chengk L, Wemn He, 39 7
Scope, Functions, and Storage Management
Scope, Functions, nd Storge Mngement Block-structured lnguges nd stck storge In-le Blocks (previous set of overheds) ctivtion records storge for locl, glol vriles First-order functions (previous set of
More informationPointers and Arrays. More Pointer Examples. Pointers CS 217
Pointers nd Arrs CS 21 1 2 Pointers More Pointer Emples Wht is pointer A vrile whose vlue is the ddress of nother vrile p is pointer to vrile v Opertions &: ddress of (reference) *: indirection (dereference)
More informationArrays as functions. Types. Multidimensional Arrays (row major, column major form) Java arrays
Louden Chpters 6,9 Types Dt Types nd Abstrct Dt Types 1 Arrys s functons f: U -> V (f U s ordnl type) f() rry C rrys types cn be wthout szes rry vrbles must hve fxed sze rry_mx( [], sze) // prmeters re
More informationcisc1110 fall 2010 lecture VI.2 call by value function parameters another call by value example:
cisc1110 fll 2010 lecture VI.2 cll y vlue function prmeters more on functions more on cll y vlue nd cll y reference pssing strings to functions returning strings from functions vrile scope glol vriles
More informationMemory Management Functions
Meory Mngeent Functions Chpter 9 Meory Mngeent Process of binding vlues to eory loctions Vlues y be sttic or dynic Vlues re ssigned t different plces Sttic eory Run-tie stck Hep 1 Meory Mngeent Sttic Meory
More informationbox Boxes and Arrows 3 true 7.59 'X' An object is drawn as a box that contains its data members, for example:
Boxes nd Arrows There re two kinds of vriles in Jv: those tht store primitive vlues nd those tht store references. Primitive vlues re vlues of type long, int, short, chr, yte, oolen, doule, nd flot. References
More informationSymbol Table management
TDDD Compilers nd interpreters TDDB44 Compiler Construction Symol Tles Symol Tles in the Compiler Symol Tle mngement source progrm Leicl nlysis Syntctic nlysis Semntic nlysis nd Intermedite code gen Code
More informationVirtual Machine (Part I)
Hrvrd University CS Fll 2, Shimon Schocken Virtul Mchine (Prt I) Elements of Computing Systems Virtul Mchine I (Ch. 7) Motivtion clss clss Min Min sttic sttic x; x; function function void void min() min()
More informationAgenda & Reading. Class Exercise. COMPSCI 105 SS 2012 Principles of Computer Science. Arrays
COMPSCI 5 SS Principles of Computer Science Arrys & Multidimensionl Arrys Agend & Reding Agend Arrys Creting & Using Primitive & Reference Types Assignments & Equlity Pss y Vlue & Pss y Reference Copying
More informationIntroduction To Files In Pascal
Why other With Files? Introduction To Files In Pscl Too much informtion to input ll t once The informtion must be persistent (RAM is voltile) Etc. In this section of notes you will lern how to red from
More informationFrom Dependencies to Evaluation Strategies
From Dependencies to Evlution Strtegies Possile strtegies: 1 let the user define the evlution order 2 utomtic strtegy sed on the dependencies: use locl dependencies to determine which ttriutes to compute
More informationSample Midterm Solutions COMS W4115 Programming Languages and Translators Monday, October 12, 2009
Deprtment of Computer cience Columbi University mple Midterm olutions COM W4115 Progrmming Lnguges nd Trnsltors Mondy, October 12, 2009 Closed book, no ids. ch question is worth 20 points. Question 5(c)
More informationToday s Lecture. Basics of Logic Design: Boolean Algebra, Logic Gates. Recursive Example. Review: The C / C++ code. Recursive Example (Continued)
Tod s Lecture Bsics of Logic Design: Boolen Alger, Logic Gtes Alvin R. Leeck CPS 4 Lecture 8 Homework #2 Due Ferur 3 Outline Review (sseml recursion) Building the uilding locks Logic Design Truth tles,
More informationDiscussion 1 Recap. COP4600 Discussion 2 OS concepts, System call, and Assignment 1. Questions. Questions. Outline. Outline 10/24/2010
COP4600 Discussion 2 OS concepts, System cll, nd Assignment 1 TA: Hufeng Jin hj0@cise.ufl.edu Discussion 1 Recp Introduction to C C Bsic Types (chr, int, long, flot, doule, ) C Preprocessors (#include,
More informationOutline. Tiling, formally. Expression tile as rule. Statement tiles as rules. Function calls. CS 412 Introduction to Compilers
CS 412 Introduction to Compilers Andrew Myers Cornell University Lectur8 Finishing genertion 9 Mr 01 Outline Tiling s syntx-directed trnsltion Implementing function clls Implementing functions Optimizing
More informationData Types. Tour of C. Like Java, Like C. Array Initialization. Array Declaration. Data Types, Arrays, Strings and Pointers in C.
Dt Tyes Tour of Dt Tyes, Arrys, Strngs nd Ponters n chr short nt long flot double long double sgned/ unsgned chr, short, nt, long 2 Lke Jv, Lke Oertors sme s n Jv - Arthmetc nt = +; ++; --; *=2; +, -,
More informationCS201 Discussion 10 DRAWTREE + TRIES
CS201 Discussion 10 DRAWTREE + TRIES DrwTree First instinct: recursion As very generic structure, we could tckle this problem s follows: drw(): Find the root drw(root) drw(root): Write the line for the
More informationIntroduction to Computer Science, Shimon Schocken, IDC Herzliya. Lecture Writing Classes
Introduction to Computer Science, Shimon Schocken, IDC Herzliy Lecture 5.1-5.2 Writing Clsses Writing Clsses, Shimon Schocken IDC Herzliy, www.ro2cs.com slide 1 Clsses Two viewpos on es: Client view: how
More informationMatrices and Systems of Equations
Mtrices Mtrices nd Sstems of Equtions A mtri is rectngulr rr of rel numbers. CHAT Pre-Clculus Section 8. m m m............ n n n mn We will use the double subscript nottion for ech element of the mtri.
More information! Smaller, simpler, subcomponent of program! Provides abstraction. n hide low-level details, give high-level structure
Function Chpte 1 Functions Oiginl slides fom Gegoy Byd, Noth Colin Stte Univesity Modified slides by Chis Wilcox, Colodo Stte Univesity! Smlle, simple, subcomponent of pogm! Povides bstction n hide lo-level
More informationCPSC 213. Polymorphism. Introduction to Computer Systems. Readings for Next Two Lectures. Back to Procedure Calls
Redings for Next Two Lectures Text CPSC 213 Switch Sttements, Understnding Pointers - 2nd ed: 3.6.7, 3.10-1st ed: 3.6.6, 3.11 Introduction to Computer Systems Unit 1f Dynmic Control Flow Polymorphism nd
More informationChapter Spline Method of Interpolation More Examples Electrical Engineering
Chpter. Spline Method of Interpoltion More Exmples Electricl Engineering Exmple Thermistors re used to mesure the temperture of bodies. Thermistors re bsed on mterils chnge in resistnce with temperture.
More informationTopics in Analytic Geometry
Nme Chpter 10 Topics in Anltic Geometr Section 10.1 Lines Objective: In this lesson ou lerned how to find the inclintion of line, the ngle between two lines, nd the distnce between point nd line. Importnt
More informationUnit #9 : Definite Integral Properties, Fundamental Theorem of Calculus
Unit #9 : Definite Integrl Properties, Fundmentl Theorem of Clculus Gols: Identify properties of definite integrls Define odd nd even functions, nd reltionship to integrl vlues Introduce the Fundmentl
More informationLecture 10 Evolutionary Computation: Evolution strategies and genetic programming
Lecture 10 Evolutionry Computtion: Evolution strtegies nd genetic progrmming Evolution strtegies Genetic progrmming Summry Negnevitsky, Person Eduction, 2011 1 Evolution Strtegies Another pproch to simulting
More informationCS 241. Fall 2017 Midterm Review Solutions. October 24, Bits and Bytes 1. 3 MIPS Assembler 6. 4 Regular Languages 7.
CS 241 Fll 2017 Midterm Review Solutions Octoer 24, 2017 Contents 1 Bits nd Bytes 1 2 MIPS Assemly Lnguge Progrmming 2 3 MIPS Assemler 6 4 Regulr Lnguges 7 5 Scnning 9 1 Bits nd Bytes 1. Give two s complement
More informationReducing Costs with Duck Typing. Structural
Reducing Costs with Duck Typing Structurl 1 Duck Typing In computer progrmming with object-oriented progrmming lnguges, duck typing is lyer of progrmming lnguge nd design rules on top of typing. Typing
More informationReference types and their characteristics Class Definition Constructors and Object Creation Special objects: Strings and Arrays
Objects nd Clsses Reference types nd their chrcteristics Clss Definition Constructors nd Object Cretion Specil objects: Strings nd Arrys OOAD 1999/2000 Cludi Niederée, Jochim W. Schmidt Softwre Systems
More informationOutline CS 412/413. Function calls. Stack layout. Tiling a call. Two translations
CS 412/413 Introduction to Compilers nd Trnsltors Cornell University Andrew Myers Outline Implementing function clls Implementing functions Optimizing wy the pointer Dynmiclly-llocted structures strings
More informationLecture Overview. Knowledge-based systems in Bioinformatics, 1MB602. Procedural abstraction. The sum procedure. Integration as a procedure
Lecture Overview Knowledge-bsed systems in Bioinformtics, MB6 Scheme lecture Procedurl bstrction Higher order procedures Procedures s rguments Procedures s returned vlues Locl vribles Dt bstrction Compound
More informationEXPONENTIAL & POWER GRAPHS
Eponentil & Power Grphs EXPONENTIAL & POWER GRAPHS www.mthletics.com.u Eponentil EXPONENTIAL & Power & Grphs POWER GRAPHS These re grphs which result from equtions tht re not liner or qudrtic. The eponentil
More informationCSE 3302 Programming Languages Lecture 5: Control
CSE 3302 Programming Languages Lecture 5: Control (based on the slides by Chengkai Li) Leonidas Fegaras University of Texas at Arlington CSE 3302 L5 Fall 2009 1 Control Control: what gets executed, when,
More information520 Principles of Programming Languages. Memory Management. Memory Management... 35: Garbage Collection
Dynmic Memory Mngement 50 Principles of Progrmming Lnguges 35: Grbge Collection Christin Collberg collberg@cs.rizon.edu Deprtment of Computer Science University of Arizon The run-time system linked in
More informationMid-term exam. Scores. Fall term 2012 KAIST EE209 Programming Structures for EE. Thursday Oct 25, Student's name: Student ID:
Fll term 2012 KAIST EE209 Progrmming Structures for EE Mid-term exm Thursdy Oct 25, 2012 Student's nme: Student ID: The exm is closed book nd notes. Red the questions crefully nd focus your nswers on wht
More informationVirtual Machine I: Stack Arithmetic
Virtul Mchine I: Stck Arithmetic Building Modern Computer From First Principles www.nnd2tetris.org Elements of Computing Systems, Nisn & Schocken, MIT Press, www.nnd2tetris.org, Chpter 7: Virtul Mchine
More information1.4 Circuit Theorems
. Crcut Theorems. v,? (C)V, 5 6 (D) V, 6 5. A smple equvlent crcut of the termnl 6 v, network shown n fg. P.. s Fg. P... (A)V, (B)V, v (C)V,5 (D)V,5 Fg. P....,? 5 V, v (A) (B) Fg. P... (A)A, 0 (B) 0 A,
More informationLists in Lisp and Scheme
Lists in Lisp nd Scheme Lists in Lisp nd Scheme Lists re Lisp s fundmentl dt structures, ut there re others Arrys, chrcters, strings, etc. Common Lisp hs moved on from eing merely LISt Processor However,
More informationSlides credited from Prof. Hung-Yi Lee
Sdes credted from Prof. Hung-Y Lee Revew Notton Summry : output of neuron : output vector of yer : weght : weght mtrx z z : nput of ctvton functon : nput vector of ctvton functon for yer b b : bs : bs
More informationGeometric transformations
Geometric trnsformtions Computer Grphics Some slides re bsed on Shy Shlom slides from TAU mn n n m m T A,,,,,, 2 1 2 22 12 1 21 11 Rows become columns nd columns become rows nm n n m m A,,,,,, 1 1 2 22
More informationPointer Analysis. CSE 501 Spring 15
Pointer Anlysis CSE 501 Sring 15 Course Outline St8c nlysis Dtflow nd strct interret8on Alic8ons We re here Beyond generl- urose lnguges Progrm Verific8on Dynmic nlysis New comilers Tody Intro to ointer
More informationIntroduction to Integration
Introduction to Integrtion Definite integrls of piecewise constnt functions A constnt function is function of the form Integrtion is two things t the sme time: A form of summtion. The opposite of differentition.
More informationQuiz2 45mins. Personal Number: Problem 1. (20pts) Here is an Table of Perl Regular Ex
Long Quiz2 45mins Nme: Personl Numer: Prolem. (20pts) Here is n Tle of Perl Regulr Ex Chrcter Description. single chrcter \s whitespce chrcter (spce, t, newline) \S non-whitespce chrcter \d digit (0-9)
More information- 2 U NIX FILES 1. Explin different file types vilble in UNIX or P OSIX s ystem. ( 08 mrks) ( My-08/Dec-08/My-10/My- 12) 2. Wht is n API? How is it di
-1 I NTRODUCTION 1. Wht is posix stndrd? Explin different subset of posix stndrd. Write structure of progrm to filter out non- p osix complint codes from user progrm. ( 06 mrks) ( Dec- 2010). 2. W rite
More informationLeast-Squares Regression
Lest-Squres Regresson Curve fttng Iprove eperentl dt Modelng 5 Eple: 7 eperentll derved ponts ehbtng sgnfcnt vrblt 5 3-7 Roberto Muscedere It s probble tht t soe pont n our creer ou wll hve to nlze soe
More informationEngineer To Engineer Note
Engineer To Engineer Note EE-188 Technicl Notes on using Anlog Devices' DSP components nd development tools Contct our technicl support by phone: (800) ANALOG-D or e-mil: dsp.support@nlog.com Or visit
More informationStack. A list whose end points are pointed by top and bottom
4. Stck Stck A list whose end points re pointed by top nd bottom Insertion nd deletion tke plce t the top (cf: Wht is the difference between Stck nd Arry?) Bottom is constnt, but top grows nd shrinks!
More informationAlgebra II Notes Unit Ten: Conic Sections
Sllus Ojective: 0. The student will sketch the grph of conic section with centers either t or not t the origin. (PARABOLAS) Review: The Midpoint Formul The midpoint M of the line segment connecting the
More informationCompiler-Assisted Cache Replacement
LCPC 3 Formulting The Prolem of Compiler-Assisted Cche Replcement Hongo Yng LCPC 3 Agend Bckground: Memory hierrchy, ISA with cche hints Prolem definition: How should compiler give cche hint to minimize
More informationStack Manipulation. Other Issues. How about larger constants? Frame Pointer. PowerPC. Alternative Architectures
Other Issues Stck Mnipultion support for procedures (Refer to section 3.6), stcks, frmes, recursion mnipulting strings nd pointers linkers, loders, memory lyout Interrupts, exceptions, system clls nd conventions
More informationCS321 Languages and Compiler Design I. Winter 2012 Lecture 5
CS321 Lnguges nd Compiler Design I Winter 2012 Lecture 5 1 FINITE AUTOMATA A non-deterministic finite utomton (NFA) consists of: An input lphet Σ, e.g. Σ =,. A set of sttes S, e.g. S = {1, 3, 5, 7, 11,
More informationImproper Integrals. October 4, 2017
Improper Integrls October 4, 7 Introduction We hve seen how to clculte definite integrl when the it is rel number. However, there re times when we re interested to compute the integrl sy for emple 3. Here
More informationMIPS I/O and Interrupt
MIPS I/O nd Interrupt Review Floting point instructions re crried out on seprte chip clled coprocessor 1 You hve to move dt to/from coprocessor 1 to do most common opertions such s printing, clling functions,
More informationCOMMON HALF YEARLY EXAMINATION DECEMBER 2018
li.net i.net li.net i.net li.net i.net li.net i.net li.net i.net li.net i.net li.net i.net li.net i.net li.net i.net.pds.pds COMMON HALF YEARLY EXAMINATION DECEMBER 2018 STD : XI SUBJECT: COMPUTER SCIENCE
More informationIntroduction to Julia for Bioinformatics
Introduction to Juli for Bioinformtics This introduction ssumes tht you hve bsic knowledge of some scripting lnguge nd provides n exmple of the Juli syntx. Continuous Assessment Problems In this course
More informationReal-Time Programming in Java
ARTIST2 Summer School 2008 in Europe Autrns (ner Grenole), Frnce Septemer 8-12, 8 2008 Rel-Time Progrmming in Jv Rel-Time in the Age of Complex Systems Invited Speker: Dvid F. Bcon IBM Reserch 0 Clssicl
More informationProcedure Abstraction
Compiler Design Procedure Absrcion Hwnsoo Hn Conrol Absrcion Procedures hve well-defined conrol-flow The Algol-60 procedure cll Invoked cll sie, wih some se of cul prmeers Conrol reurns o cll sie, immediely
More informationSystems I. Logic Design I. Topics Digital logic Logic gates Simple combinational logic circuits
Systems I Logic Design I Topics Digitl logic Logic gtes Simple comintionl logic circuits Simple C sttement.. C = + ; Wht pieces of hrdwre do you think you might need? Storge - for vlues,, C Computtion
More information2 Computing all Intersections of a Set of Segments Line Segment Intersection
15-451/651: Design & Anlysis of Algorithms Novemer 14, 2016 Lecture #21 Sweep-Line nd Segment Intersection lst chnged: Novemer 8, 2017 1 Preliminries The sweep-line prdigm is very powerful lgorithmic design
More information11/28/18 FIBONACCI NUMBERS GOLDEN RATIO, RECURRENCES. Announcements. Announcements. Announcements
Fiboncci (Leonrdo Pisno) 0-0? Sttue in Pis Itly FIBONACCI NUERS GOLDEN RATIO, RECURRENCES Lecture CS0 Fll 08 Announcements A: NO LATE DAYS. No need to put in time nd comments. We hve to grde quickly. No
More informationLexical Analysis. Amitabha Sanyal. (www.cse.iitb.ac.in/ as) Department of Computer Science and Engineering, Indian Institute of Technology, Bombay
Lexicl Anlysis Amith Snyl (www.cse.iit.c.in/ s) Deprtment of Computer Science nd Engineering, Indin Institute of Technology, Bomy Septemer 27 College of Engineering, Pune Lexicl Anlysis: 2/6 Recp The input
More information1.5 Extrema and the Mean Value Theorem
.5 Extrem nd the Men Vlue Theorem.5. Mximum nd Minimum Vlues Definition.5. (Glol Mximum). Let f : D! R e function with domin D. Then f hs n glol mximum vlue t point c, iff(c) f(x) for ll x D. The vlue
More informationFig.25: the Role of LEX
The Lnguge for Specifying Lexicl Anlyzer We shll now study how to uild lexicl nlyzer from specifiction of tokens in the form of list of regulr expressions The discussion centers round the design of n existing
More information8.2 Areas in the Plane
39 Chpter 8 Applictions of Definite Integrls 8. Ares in the Plne Wht ou will lern out... Are Between Curves Are Enclosed Intersecting Curves Boundries with Chnging Functions Integrting with Respect to
More informationMachine Level Programming: Arrays, Structures and More
Mchne Level Pogmmng: ys, Stuctues nd Moe Compute Systems Ognzton (Spng 2016) CSCI-U 201, Secton 2 1D ys Instucto: Jonn Klukowsk Sldes dpted fom Rndl E. Bynt nd Dvd R. O Hllon (CMU) Mohmed Zhn (NYU) 2 y
More informationExample: 2:1 Multiplexer
Exmple: 2:1 Multiplexer Exmple #1 reg ; lwys @( or or s) egin if (s == 1') egin = ; else egin = ; 1 s B. Bs 114 Exmple: 2:1 Multiplexer Exmple #2 Normlly lwys include egin nd sttements even though they
More informationScanner Termination. Multi Character Lookahead. to its physical end. Most parsers require an end of file token. Lex and Jlex automatically create an
Scnner Termintion A scnner reds input chrcters nd prtitions them into tokens. Wht hppens when the end of the input file is reched? It my be useful to crete n Eof pseudo-chrcter when this occurs. In Jv,
More informationDynamic Programming. Andreas Klappenecker. [partially based on slides by Prof. Welch] Monday, September 24, 2012
Dynmic Progrmming Andres Klppenecker [prtilly bsed on slides by Prof. Welch] 1 Dynmic Progrmming Optiml substructure An optiml solution to the problem contins within it optiml solutions to subproblems.
More informationProgramming. Example - Complex Numbers. add_complex step by step. add_complex step by step. add_complex step by step י"ט/טבת/תשע"א
Emple - Comple Numers Progrmming Structure declrtion tpedef struct comple doule, ; Comple ; Structures Vrile definition Comple c1, c2; Structures nd Functions - Emple Comple mke_comple(doule, doule ) Comple
More informationCSCI 3130: Formal Languages and Automata Theory Lecture 12 The Chinese University of Hong Kong, Fall 2011
CSCI 3130: Forml Lnguges nd utomt Theory Lecture 12 The Chinese University of Hong Kong, Fll 2011 ndrej Bogdnov In progrmming lnguges, uilding prse trees is significnt tsk ecuse prse trees tell us the
More informationMidterm 2 Sample solution
Nme: Instructions Midterm 2 Smple solution CMSC 430 Introduction to Compilers Fll 2012 November 28, 2012 This exm contins 9 pges, including this one. Mke sure you hve ll the pges. Write your nme on the
More informationThe notation y = f(x) gives a way to denote specific values of a function. The value of f at a can be written as f( a ), read f of a.
Chpter Prerequisites for Clculus. Functions nd Grphs Wht ou will lern out... Functions Domins nd Rnges Viewing nd Interpreting Grphs Even Functions nd Odd Functions Smmetr Functions Defined in Pieces Asolute
More information6.3 Definite Integrals and Antiderivatives
Section 6. Definite Integrls nd Antiderivtives 8 6. Definite Integrls nd Antiderivtives Wht ou will lern out... Properties of Definite Integrls Averge Vlue of Function Men Vlue Theorem for Definite Integrls
More informationUNIT 11. Query Optimization
UNIT Query Optimiztion Contents Introduction to Query Optimiztion 2 The Optimiztion Process: An Overview 3 Optimiztion in System R 4 Optimiztion in INGRES 5 Implementing the Join Opertors Wei-Png Yng,
More informationHow to Design REST API? Written Date : March 23, 2015
Visul Prdigm How Design REST API? Turil How Design REST API? Written Dte : Mrch 23, 2015 REpresenttionl Stte Trnsfer, n rchitecturl style tht cn be used in building networked pplictions, is becoming incresingly
More informationDesigning Secure Ethereum Smart Contracts: A Finite State Machine Based Approach
Designing Secure Ereum Smrt Ctrcts: A Finite Stte Mchine Bsed Approch Anstsi Mvridou 1 nd Ar Lszk 2 1 Vnderbilt University 2 University Houst 2 Smrt Ctrct Insecurity Smrt ctrcts re riddled with bugs nd
More informationChapter 7. Routing with Frame Relay, X.25, and SNA. 7.1 Routing. This chapter discusses Frame Relay, X.25, and SNA Routing. Also see the following:
Chpter 7 Routing with Frme Rely, X.25, nd SNA This chpter discusses Frme Rely, X.25, nd SNA Routing. Also see the following: Section 4.2, Identifying the BANDIT in the Network Section 4.3, Defining Globl
More informationSemantics. Names. Binding Time
/24/ CSE 3302 Programming Languages Semantics Chengkai Li, Weimin He Spring Names Names: identif language entities variables, procedures, functions, constants, data tpes, Attributes: properties of names
More informationGeorge Boole. IT 3123 Hardware and Software Concepts. Switching Algebra. Boolean Functions. Boolean Functions. Truth Tables
George Boole IT 3123 Hrdwre nd Softwre Concepts My 28 Digitl Logic The Little Mn Computer 1815 1864 British mthemticin nd philosopher Mny contriutions to mthemtics. Boolen lger: n lger over finite sets
More informationCSCI 104. Rafael Ferreira da Silva. Slides adapted from: Mark Redekopp and David Kempe
CSCI 0 fel Ferreir d Silv rfsilv@isi.edu Slides dpted from: Mrk edekopp nd Dvid Kempe LOG STUCTUED MEGE TEES Series Summtion eview Let n = + + + + k $ = #%& #. Wht is n? n = k+ - Wht is log () + log ()
More informationOPERATION MANUAL. DIGIFORCE 9307 PROFINET Integration into TIA Portal
OPERATION MANUAL DIGIFORCE 9307 PROFINET Integrtion into TIA Portl Mnufcturer: 2018 burster präzisionsmesstechnik gmbh & co kg burster präzisionsmesstechnik gmbh & co kg Alle Rechte vorbehlten Tlstrße
More informationMTH 146 Conics Supplement
105- Review of Conics MTH 146 Conics Supplement In this section we review conics If ou ne more detils thn re present in the notes, r through section 105 of the ook Definition: A prol is the set of points
More informationCURVE FITTING AND DATA REGRESSION
Numercl Methods Process Sstems Engneerng CURVE FIING AND DAA REGRESSION Numercl methods n chemcl engneerng Dr. Edwn Zondervn Numercl Methods Process Sstems Engneerng Dngerous curves!!! hs s not ectl wht
More informationSection 9.2 Hyperbolas
Section 9. Hperols 597 Section 9. Hperols In the lst section, we lerned tht plnets hve pproimtel ellipticl orits round the sun. When n oject like comet is moving quickl, it is le to escpe the grvittionl
More informationCS240: Programming in C. Lecture 12: Polymorphic Sorting
CS240: Programmng n C ecture 12: Polymorphc Sortng Sortng Gven a collecton of tems and a total order over them, sort the collecton under ths order. Total order: every tem s ordered wth respect to every
More informationSpring 2018 Midterm Exam 1 March 1, You may not use any books, notes, or electronic devices during this exam.
15-112 Spring 2018 Midterm Exm 1 Mrch 1, 2018 Nme: Andrew ID: Recittion Section: You my not use ny books, notes, or electronic devices during this exm. You my not sk questions bout the exm except for lnguge
More informationBasics of Logic Design Arithmetic Logic Unit (ALU)
Bsics of Logic Design Arithmetic Logic Unit (ALU) CPS 4 Lecture 9 Tody s Lecture Homework #3 Assigned Due Mrch 3 Project Groups ssigned & posted to lckord. Project Specifiction is on We Due April 9 Building
More informationPARALLEL AND DISTRIBUTED COMPUTING
PARALLEL AND DISTRIBUTED COMPUTING 2009/2010 1 st Semester Teste Jnury 9, 2010 Durtion: 2h00 - No extr mteril llowed. This includes notes, scrtch pper, clcultor, etc. - Give your nswers in the ville spce
More informationCreating Flexible Interfaces. Friday, 24 April 2015
Creting Flexible Interfces 1 Requests, not Objects Domin objects re esy to find but they re not t the design center of your ppliction. Insted, they re trp for the unwry. Sequence digrms re vehicle for
More informationcan also encrypt with d and decrypt with e Rivest, Shamir, Adleman Generate two primes: p, q
CSCI, Spng Pulc Ke Cptogph CSCI, Spng CS Pulc Ke Cptogph Bll Cheng http://melot.usc.edu/css k smmetc cptogph Bsed on some NPcomplete polem tvelng slesmn polem n ctes, connected fnd shotest tou, ll ctes
More informationFunctor (1A) Young Won Lim 8/2/17
Copyright (c) 2016-2017 Young W. Lim. Permission is grnted to copy, distribute nd/or modify this document under the terms of the GNU Free Documenttion License, Version 1.2 or ny lter version published
More informationLanguages. L((a (b)(c))*) = { ε,a,bc,aa,abc,bca,... } εw = wε = w. εabba = abbaε = abba. (a (b)(c)) *
Pln for Tody nd Beginning Next week Interpreter nd Compiler Structure, or Softwre Architecture Overview of Progrmming Assignments The MeggyJv compiler we will e uilding. Regulr Expressions Finite Stte
More informationSummer Review Packet For Algebra 2 CP/Honors
Summer Review Pcket For Alger CP/Honors Nme Current Course Mth Techer Introduction Alger uilds on topics studied from oth Alger nd Geometr. Certin topics re sufficientl involved tht the cll for some review
More information4/29/18 FIBONACCI NUMBERS GOLDEN RATIO, RECURRENCES. Fibonacci function. Fibonacci (Leonardo Pisano) ? Statue in Pisa Italy
/9/8 Fioncci (Leonrdo Pisno) -? Sttue in Pis Itly FIBONACCI NUERS GOLDEN RATIO, RECURRENCES Lecture CS Spring 8 Fioncci function fi() fi() fi(n) fi(n-) + fi(n-) for n,,,,,, 8,,, In his ook in titled Lier
More informationCS412/413. Introduction to Compilers Tim Teitelbaum. Lecture 4: Lexical Analyzers 28 Jan 08
CS412/413 Introduction to Compilers Tim Teitelum Lecture 4: Lexicl Anlyzers 28 Jn 08 Outline DFA stte minimiztion Lexicl nlyzers Automting lexicl nlysis Jlex lexicl nlyzer genertor CS 412/413 Spring 2008
More informationControl-Flow Analysis and Loop Detection
! Control-Flow Anlysis nd Loop Detection!Lst time! PRE!Tody! Control-flow nlysis! Loops! Identifying loops using domintors! Reducibility! Using loop identifiction to identify induction vribles CS553 Lecture
More informationFunctor (1A) Young Won Lim 10/5/17
Copyright (c) 2016-2017 Young W. Lim. Permission is grnted to copy, distribute nd/or modify this document under the terms of the GNU Free Documenttion License, Version 1.2 or ny lter version published
More informationFinding the Needle. Stack Traces for GHC. Tristan O.R. Allwood. Susan Eisenbach. Simon Peyton Jones. Abstract. 1. Motivation
Tristn O.R. Allwood Imperil College tor@doc.ic.c.uk Finding the Needle Stck Trces for GHC Simon Peyton Jones Microsoft Reserch simonpj@microsoft.com Susn Eisench Imperil College susn.eisench@imperil.c.uk
More informationSolution of Linear Algebraic Equations using the Gauss-Jordan Method
Solution of Liner Algebric Equtions using the Guss-Jordn Method Populr pproch for solving liner equtions The Guss Jordn method depends on two properties of liner equtions: Scling one or more of ny of the
More informationLesson 11 MA Nick Egbert
Lesson MA 62 Nick Eert Overview In this lesson we return to stndrd Clculus II mteril with res etween curves. Recll rom irst semester clculus tht the deinite interl hd eometric menin, nmel the re under
More informationDr. D.M. Akbar Hussain
Dr. D.M. Akr Hussin Lexicl Anlysis. Bsic Ide: Red the source code nd generte tokens, it is similr wht humns will do to red in; just tking on the input nd reking it down in pieces. Ech token is sequence
More information