Abstract Syntax Trees. AST Data Structure. Visitor Interface. Accept methods. Visitor Methodology for AST Traversal CS412/CS413
|
|
- Leo Young
- 6 years ago
- Views:
Transcription
1 Abstract Syta Trees CS412/CS413 Itroductio to Copilers Ti Teitelbau Lecture 12: Visitors; Sybol Tables February 18, 2005 Separate AST costructio fro seatic checkig phase Traverse the AST ad perfor seatic checks (or other actios) oly after the tree has bee built ad its structure is stable This approach is less error-proe It is better whe efficiecy is ot a critical issue CS 412/413 Sprig 2005 Itroductio to Copilers 1 CS 412/413 Sprig 2005 Itroductio to Copilers 2 Visitor Methodology for AST Traversal Visitor patter: useful OO prograig patter that separates data structure defiitio (e.g., the AST) fro code that traverses the structure (e.g., the ae resolutio code ad the type checkig code). Defie a Visitor erface for all traversals of the AST Eted each AST class with a ethod that accepts ay Visitor Code each traversal as a separate class that ipleets the Visitor erface AST Data Structure abstract class Epr Epr { class Add Addeteds Epr Epr { Epr Epr e1, e1, e2 e2 class Nu Nueteds Epr Epr { value class Id Ideteds Epr Epr { Strig ae CS 412/413 Sprig 2005 Itroductio to Copilers 3 CS 412/413 Sprig 2005 Itroductio to Copilers 4 Visitor Iterface Accept ethods erface Visitor { void visit(add e); e); void visit(nu e); e); void visit(id e); e); abstract class classepr {{ abstract public publicvoid voidaccept(visitor v); v); class classadd Addeteds Epr Epr { { public publicvoid voidaccept(visitor v) v) {{ v.visit(this); class classnu Nueteds Epr Epr { { public publicvoid voidaccept(visitor v) v) {{ v.visit(this); class classid Ideteds Epr Epr {{ public publicvoid voidaccept(visitor v) v) {{ v.visit(this); The declared type of this is the subclass it which it occurs. Overload resolutio of v.visit(this); ivokes appropriate visit fuctio i the Visitor. CS 412/413 Sprig 2005 Itroductio to Copilers 5 CS 412/413 Sprig 2005 Itroductio to Copilers 6
2 Visitor Methods For each kid of traversal, ipleet the Visitor erface, e.g., class PostfiOutputVisitor ipleets Visitor { void visit(add e) { e.e1.accept(this); e.e2.accept(this); Syste.out.pr( + ); void visit(nu e) { Syste.out.pr(value); void visit(id e) { Syste.out.pr(id); Dispatch i the visit ethods eliiates case aalysis o AST subclasses To traverse epressio e: PostfiOutputVisitor v = ew PostfiOutputVisitor(); e.accept(v); Iherited ad Sythesized Iforatio So far, OK for traversal ad actio w/o couicatio of values But we eed a way to pass iforatio Dow the AST (iherited) Up the AST (sythesized) To pass iforatio dow the AST add paraeter to visit fuctios To pass iforatio up the AST add retur value to visit fuctios CS 412/413 Sprig 2005 Itroductio to Copilers 7 CS 412/413 Sprig 2005 Itroductio to Copilers 8 Visitor Iterface (2) Accept ethods (2) erface Visitor { Object visit(add e, e, Object ih); Object visit(nu e, e, Object ih); ih); Object visit(id e, e, Object ih); ih); abstract class classepr {{ abstract public publicobject Objectaccept(Visitor v, v, Object Object ih); ih); class classadd Addeteds Epr Epr { { public publicobject Objectaccept(Visitor v, v, Object Object ih) ih) {{ retur returv.visit(this, ih); ih); class classnu Nueteds Epr Epr { { public publicobject Objectaccept(Visitor v, v, Object Object ih) ih) {{ retur returv.visit(this, ih); ih); class classid Ideteds Epr Epr {{ public publicobject Objectaccept(Visitor v, v, Object Object ih) ih) {{ retur returv.visit(this, ih); ih); CS 412/413 Sprig 2005 Itroductio to Copilers 9 CS 412/413 Sprig 2005 Itroductio to Copilers 10 Visitor Methods (2) For kid of traversal, ipleet the Visitor erface, e.g., class EvaluatioVisitor ipleets Visitor { Object visit(add e, Object ih) { left = () e.e1.accept(this, ih); right = () e.e2.accept(this, ih); retur left+right; Object visit(nu e, Object ih) { retur value; Object visit(id e, Object ih) { retur Lookup(id, (SybolTable)ih); To traverse epressio e: EvaluatioVisitor v = ew EvaluatioVisitor (); e.accept(v); CS 412/413 Sprig 2005 Itroductio to Copilers 11 Icorrect Progras Leically ad sytactically correct progras ay still cotai other errors! Leical ad syta aalysis are ot powerful eough to esure the correct usage of iables, objects, fuctios, stateets, etc. CS 412/413 Sprig 2005 Itroductio to Copilers 12
3 Icorrect Progras Eaple 1: leical aalysis does ot distiguish betwee differet iable or fuctio idetifiers (it returs the sae toke for all idetifiers) a; a; a = 1; b = 1; Eaple 2: syta aalysis does ot correlate the declaratios with the uses of iables i the progra: a; a = 1; a= 1; Eaple 3: syta aalysis does ot correlate the types fro the declaratios with the uses of iables: a; a; a = 1; a = 1.0; CS 412/413 Sprig 2005 Itroductio to Copilers 13 Goals of Seatic Aalysis Seatic aalysis = esure that the progra satisfies a set of rules regardig the usage of prograig costructs (iables, objects, epressios, stateets) Eaples of seatic rules: Variables ust be declared before beig used A iable should ot be declared ultiple ties i the sae scope I a assiget stateet, the iable ad the assiged epressio ust have the sae type The coditio of a if-stateet ust have type boolea Soe categories of rules: Seatic rules regardig types Seatic rules regardig scopes CS 412/413 Sprig 2005 Itroductio to Copilers 14 Type Iforatio Type iforatio = describes what kid of values correspod to differet costructs: iables, stateets, epressios, fuctios iables: a; eger epressios: (a+1) == 2 boolea stateets: a = 1.0 ig-po fuctios: pow(, ) Type Checkig Type checkig = set of rules that esure the type cosistecy of differet costructs i the progra Eaples: The type of a iable ust atch the type fro its declaratio The operads of arithetic epressios (+, *, -, /) ust have eger types; the result has eger type The operads of copariso epressios (==,!=) ust have eger or strig types; the result has boolea type CS 412/413 Sprig 2005 Itroductio to Copilers 15 CS 412/413 Sprig 2005 Itroductio to Copilers 16 Type Checkig More eaples: For each assiget stateet, the type of the updated iable ust atch the type of the epressio beig assiged For each call stateet foo(v 1,, v ), the type of each actual uet v i ust atch the type of the correspodig foral uet f i fro the declaratio of fuctio foo The type of the retur value ust atch the retur type fro the declaratio of the fuctio Type checkig: et two lectures. Scope Iforatio Scope iforatio = characterizes the declaratio of idetifiers ad the portios of the progra where it is allowed to use each idetifier Eaple idetifiers: iables, fuctios, objects, labels Leical scope = tetual regio i the progra Stateet block Foral uet list Object body Fuctio or ethod body Module body Whole progra (ultiple odules) Scope of a idetifier: the leical scope i which it is valid CS 412/413 Sprig 2005 Itroductio to Copilers 17 CS 412/413 Sprig 2005 Itroductio to Copilers 18
4 Scope Iforatio Scope of iables i stateet blocks: { a; scope of iable a { b; scope of iable b I C: Scope of file static iables: curret file Scope of eteral iables: whole progra Scope of autoatic iables, foral paraeters, ad fuctio static iables: the fuctio Scope of foral uets of fuctios/ethods: factorial( ) { Scope of labels: void f() { goto l; l: a =1; goto l; Scope Iforatio scope of foral paraeter scope of label l CS 412/413 Sprig 2005 Itroductio to Copilers 19 CS 412/413 Sprig 2005 Itroductio to Copilers 20 Scope Iforatio Scope of object fields ad ethods: class A { private ; public void g() { =1; class B eteds A { public h() { g(); scope of field scope of ethod g CS 412/413 Sprig 2005 Itroductio to Copilers 21 Seatic Rules for Scopes Mai rules regardig scopes: Rule 1: Use a idetifier oly if defied i eclosig scope Rule 2: Do ot declare idetifiers of the sae kid with idetical aes ore tha oce i the sae leical scope Ca declare idetifiers with the sae ae with idetical or overlappig leical scopes if they are of differet kids class X { X; void X( X) { X: for(;;) break X; X( X) { X; goto X; { X; X: X = 1; Not Recoeded! CS 412/413 Sprig 2005 Itroductio to Copilers 22 Sybol Tables Seatic checks refer to properties of idetifiers i the progra -- their scope or type Need a eviroet to store the iforatio about idetifiers = sybol table Each etry i the sybol table cotais the ae of a idetifier additioal iforatio: its kid, its type, if it is costat, NAME foo tp KIND fu TYPE bool bool ATTRIBUTES eter cost cost Scope Iforatio How to capture the scope iforatio i the sybol table? Idea: There is a hierarchy of scopes i the progra Use a siilar hierarchy of sybol tables Oe sybol table for each scope Each sybol table cotais the sybols declared i that leical scope CS 412/413 Sprig 2005 Itroductio to Copilers 23 CS 412/413 Sprig 2005 Itroductio to Copilers 24
5 Eaple Idetifiers With Sae Nae ; void f( ) {, y; { i, j; ; { ; l: ; g( ) { bool t; ; i j fuc f sytab y f g l Global sytab fu void fu lab t fuc g sytab bool The hierarchical structure of sybol tables autoatically solves the proble of resolvig ae collisios (idetifiers with the sae ae ad overlappig scopes) To fid which is the declaratio of a idetifier that is active at a progra po: Start fro the curret scope Go up i the hierarchy util you fid a idetifier with the sae ae CS 412/413 Sprig 2005 Itroductio to Copilers 25 CS 412/413 Sprig 2005 Itroductio to Copilers 26 ; void f( ) {, y; { i, j; = 1; { ; l: = 2; g( ) { bool t; = 3; i j Eaple y Global sytab f fu void g fu l lab = 1 = 2 t bool = 3 ; Catchig Seatic Errors void f( ) {, y; { i, j; = 1; { ; l: i = 2; g( ) { bool t; = 3; i j y f g l fu void fu lab = 1 i = 2 t Error! bool = 3 CS 412/413 Sprig 2005 Itroductio to Copilers 27 CS 412/413 Sprig 2005 Itroductio to Copilers 28 Sybol Table Operatios Two operatios: To build sybol tables, we eed to isert ew idetifiers i the table I the subsequet stages of the copiler we eed to access the iforatio fro the table: use a lookup fuctio Caot build sybol tables durig leical aalysis hierarchy of scopes ecoded i the syta Build the sybol tables: while parsig, usig the seatic actios After the AST is costructed CS 412/413 Sprig 2005 Itroductio to Copilers 29 Array Ipleetatio Siple ipleetatio = array Oe etry per sybol Sca the array for lookup, copare ae at each etry foo tp fu bool bool Disadvatage: table has fied size eed to kow i advace the uber of etries CS 412/413 Sprig 2005 Itroductio to Copilers 30
6 List Ipleetatio Dyaic structure = list Oe cell per etry i the table Ca grow dyaically durig copilatio foo fuc bool Disadvatage: iefficiet for le sybol tables eed to sca half the list o average tp Var bool Hash Table Ipleetatio Efficiet ipleetatio = hash table It is a array of lists (buckets) Uses a hashig fuctio to ap the sybol ae to the correspodig bucket: hashfuc : strig Good hash fuctio = eve distributio i the buckets foo fuc hashfuc( ) = 0, hashfuc( foo ) = 3 tp bool CS 412/413 Sprig 2005 Itroductio to Copilers 31 CS 412/413 Sprig 2005 Itroductio to Copilers 32 Forward Refereces Forward refereces = use a idetifier withi the scope of its declaratio, but before it is declared Ay copiler phase that uses the iforatio fro the sybol table ust be perfored after the table is costructed Caot type-check ad build sybol table at the sae tie Eaple: class A { () { retur (); () { retur 1; CS 412/413 Sprig 2005 Itroductio to Copilers 33 Suary Seatic checks esure the correct usage of iables, objects, epressios, stateets, fuctios, ad labels i the progra Scope seatic checks esure that idetifiers are correctly used withi the scope of their declaratio Type seatic checks esures the type cosistecy of ious costructs i the progra Sybol tables: a data structure for storig iforatio about sybols i the progra Used i seatic aalysis ad subsequet copiler stages Net tie: type-checkig CS 412/413 Sprig 2005 Itroductio to Copilers 34
OPC Server ECL Comfort 210/310 OPC Server
OPC Server Descriptio j l j o j l k j l j Modbus-RS485 k Etheret or Iteret l Modbus-TCP ECL Cofort cotroller Heat eter o SCADA server The Dafoss is a OPC-copliat server that serves data to OPC cliets.
More informationChapter 10. Defining Classes. Copyright 2015 Pearson Education, Ltd.. All rights reserved.
Chapter 10 Defiig Classes Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Overview 10.1 Structures 10.2 Classes 10.3 Abstract Data Types 10.4 Itroductio to Iheritace Copyright 2015 Pearso Educatio,
More informationChapter 9. Pointers and Dynamic Arrays. Copyright 2015 Pearson Education, Ltd.. All rights reserved.
Chapter 9 Poiters ad Dyamic Arrays Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Overview 9.1 Poiters 9.2 Dyamic Arrays Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Slide 9-3
More informationCIS 121 Data Structures and Algorithms with Java Spring Stacks and Queues Monday, February 12 / Tuesday, February 13
CIS Data Structures ad Algorithms with Java Sprig 08 Stacks ad Queues Moday, February / Tuesday, February Learig Goals Durig this lab, you will: Review stacks ad queues. Lear amortized ruig time aalysis
More informationStructured Programming Lecture 3
Lecture 3 outlie B16 Software Egieerig Structured Prograig Lecture 3 Scope, dyaic eory, poiters, refereces, recursio, stack, copouds Dr Adrea Vedaldi For lecture otes, tutorial sheets, ad updates see http://www.vlfeat.org/~vedaldi/teach.htl
More informationCS 11 C track: lecture 1
CS 11 C track: lecture 1 Prelimiaries Need a CMS cluster accout http://acctreq.cms.caltech.edu/cgi-bi/request.cgi Need to kow UNIX IMSS tutorial liked from track home page Track home page: http://courses.cms.caltech.edu/courses/cs11/material
More informationToday s objectives. CSE401: Introduction to Compiler Construction. What is a compiler? Administrative Details. Why study compilers?
CSE401: Itroductio to Compiler Costructio Larry Ruzzo Sprig 2004 Today s objectives Admiistrative details Defie compilers ad why we study them Defie the high-level structure of compilers Associate specific
More informationIntroduction to Sigma Notation
Itroductio to Siga Notatio Steph de Silva //207 What is siga otatio? is the capital Greek letter for the soud s I this case, it s just shorthad for su Siga otatio is what we use whe we have a series of
More informationMAXIMUM MATCHINGS IN COMPLETE MULTIPARTITE GRAPHS
Fura Uiversity Electroic Joural of Udergraduate Matheatics Volue 00, 1996 6-16 MAXIMUM MATCHINGS IN COMPLETE MULTIPARTITE GRAPHS DAVID SITTON Abstract. How ay edges ca there be i a axiu atchig i a coplete
More informationChapter 11. Friends, Overloaded Operators, and Arrays in Classes. Copyright 2014 Pearson Addison-Wesley. All rights reserved.
Chapter 11 Frieds, Overloaded Operators, ad Arrays i Classes Copyright 2014 Pearso Addiso-Wesley. All rights reserved. Overview 11.1 Fried Fuctios 11.2 Overloadig Operators 11.3 Arrays ad Classes 11.4
More informationLecture 3 outline. Lecture 3 outline
Lecture 3 outlie Local ad global variables Modularisatio ad side effects B16 Software Egieerig Structured Prograig Lecture 3:, dyaic eory, poiters, refereces, recursio, stack, copouds Dr Adrea Vedaldi
More information% Sun Logo for. X3T10/95-229, Revision 0. April 18, 1998
Su Microsystems, Ic. 2550 Garcia Aveue Moutai View, CA 94045 415 960-1300 X3T10/95-229, Revisio 0 April 18, 1998 % Su Logo for Joh Lohmeyer Chairperso, X3T10 Symbios Logic Ic. 1635 Aeroplaza Drive Colorado
More informationComputers and Scientific Thinking
Computers ad Scietific Thikig David Reed, Creighto Uiversity Chapter 15 JavaScript Strigs 1 Strigs as Objects so far, your iteractive Web pages have maipulated strigs i simple ways use text box to iput
More informationCIS 121 Data Structures and Algorithms with Java Spring Stacks, Queues, and Heaps Monday, February 18 / Tuesday, February 19
CIS Data Structures ad Algorithms with Java Sprig 09 Stacks, Queues, ad Heaps Moday, February 8 / Tuesday, February 9 Stacks ad Queues Recall the stack ad queue ADTs (abstract data types from lecture.
More informationCS200: Hash Tables. Prichard Ch CS200 - Hash Tables 1
CS200: Hash Tables Prichard Ch. 13.2 CS200 - Hash Tables 1 Table Implemetatios: average cases Search Add Remove Sorted array-based Usorted array-based Balaced Search Trees O(log ) O() O() O() O(1) O()
More informationHash Tables. Presentation for use with the textbook Algorithm Design and Applications, by M. T. Goodrich and R. Tamassia, Wiley, 2015.
Presetatio for use with the textbook Algorithm Desig ad Applicatios, by M. T. Goodrich ad R. Tamassia, Wiley, 2015 Hash Tables xkcd. http://xkcd.com/221/. Radom Number. Used with permissio uder Creative
More informationCS211 Fall 2003 Prelim 2 Solutions and Grading Guide
CS11 Fall 003 Prelim Solutios ad Gradig Guide Problem 1: (a) obj = obj1; ILLEGAL because type of referece must always be a supertype of type of object (b) obj3 = obj1; ILLEGAL because type of referece
More informationThe Magma Database file formats
The Magma Database file formats Adrew Gaylard, Bret Pikey, ad Mart-Mari Breedt Johaesburg, South Africa 15th May 2006 1 Summary Magma is a ope-source object database created by Chris Muller, of Kasas City,
More informationCIS 121. Introduction to Trees
CIS 121 Itroductio to Trees 1 Tree ADT Tree defiitio q A tree is a set of odes which may be empty q If ot empty, the there is a distiguished ode r, called root ad zero or more o-empty subtrees T 1, T 2,
More informationLecture 1: Introduction and Strassen s Algorithm
5-750: Graduate Algorithms Jauary 7, 08 Lecture : Itroductio ad Strasse s Algorithm Lecturer: Gary Miller Scribe: Robert Parker Itroductio Machie models I this class, we will primarily use the Radom Access
More informationChapter 5. Functions for All Subtasks. Copyright 2015 Pearson Education, Ltd.. All rights reserved.
Chapter 5 Fuctios for All Subtasks Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Overview 5.1 void Fuctios 5.2 Call-By-Referece Parameters 5.3 Usig Procedural Abstractio 5.4 Testig ad Debuggig
More informationtop() Applications of Stacks
CS22 Algorithms ad Data Structures MW :00 am - 2: pm, MSEC 0 Istructor: Xiao Qi Lecture 6: Stacks ad Queues Aoucemets Quiz results Homework 2 is available Due o September 29 th, 2004 www.cs.mt.edu~xqicoursescs22
More informationModeling, Specification, and Verification of Automaton Programs
ISSN 0361-7688, Prograig ad Coputer Software, 2008, Vol. 34, No. 1, pp. 27 43. Pleiades Publishig, Ltd., 2008. Origial Russia Text E.V. Kuzi, V.A. Sokolov, 2008, published i Prograirovaie, 2008, Vol. 34,
More informationContextual Analysis. Overview of Lecture 3. Ch 4 Syntactic Analysis. Mededelingen
Overview of Lecture 3 otextual Aalysis Mededelige h 4 Sytactic Aalysis 4.1-3 4.4 Abstract Sytax Trees 4.5-6 VB H3 Vertalerbouw H3 http://fmt.cs.utwete.l/courses/vertalerbouw/! h 5 otextual Aalysis 5.1
More informationSolution printed. Do not start the test until instructed to do so! CS 2604 Data Structures Midterm Spring, Instructions:
CS 604 Data Structures Midterm Sprig, 00 VIRG INIA POLYTECHNIC INSTITUTE AND STATE U T PROSI M UNI VERSI TY Istructios: Prit your ame i the space provided below. This examiatio is closed book ad closed
More informationCopyright 2016 Ramez Elmasri and Shamkant B. Navathe
Copyright 2016 Ramez Elmasri ad Shamkat B. Navathe CHAPTER 18 Strategies for Query Processig Copyright 2016 Ramez Elmasri ad Shamkat B. Navathe Itroductio DBMS techiques to process a query Scaer idetifies
More informationJava Expressions & Flow Control
Java Expressios & Flow Cotrol Rui Moreira Expressio Separators:. [ ] ( ), ; Dot used as decimal separator or to access attributes ad methods double d = 2.6; Poto poto = ew Poto(2, 3); it i = poto.x; it
More informationCSE 417: Algorithms and Computational Complexity
Time CSE 47: Algorithms ad Computatioal Readig assigmet Read Chapter of The ALGORITHM Desig Maual Aalysis & Sortig Autum 00 Paul Beame aalysis Problem size Worst-case complexity: max # steps algorithm
More informationWhere We Are. Incorrect Programs. Non-Context-Free Syntax. Goals of Semantic Analysis. Type Information CS412/CS413
Where We Are CS412/CS413 Iroduco o Copers T Teebau Lecure 12: Sbo Tabes Februar 20, 2007 Source code (characer srea) Toke srea Absrac sa ree (AST) Decoraed AST f (b == 0) a = b; f ( b == 0 ) a = b ; f
More information. Written in factored form it is easy to see that the roots are 2, 2, i,
CMPS A Itroductio to Programmig Programmig Assigmet 4 I this assigmet you will write a java program that determies the real roots of a polyomial that lie withi a specified rage. Recall that the roots (or
More informationCopyright 2016 Ramez Elmasri and Shamkant B. Navathe
Copyright 2016 Ramez Elmasri ad Shamkat B. Navathe CHAPTER 22 Database Recovery Techiques Copyright 2016 Ramez Elmasri ad Shamkat B. Navathe Itroductio Recovery algorithms Recovery cocepts Write-ahead
More informationUniversity of Waterloo Department of Electrical and Computer Engineering ECE 250 Algorithms and Data Structures
Uiversity of Waterloo Departmet of Electrical ad Computer Egieerig ECE 250 Algorithms ad Data Structures Midterm Examiatio ( pages) Istructor: Douglas Harder February 7, 2004 7:30-9:00 Name (last, first)
More informationChapter 4. Procedural Abstraction and Functions That Return a Value. Copyright 2015 Pearson Education, Ltd.. All rights reserved.
Chapter 4 Procedural Abstractio ad Fuctios That Retur a Value Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Overview 4.1 Top-Dow Desig 4.2 Predefied Fuctios 4.3 Programmer-Defied Fuctios 4.4
More informationCSC 220: Computer Organization Unit 11 Basic Computer Organization and Design
College of Computer ad Iformatio Scieces Departmet of Computer Sciece CSC 220: Computer Orgaizatio Uit 11 Basic Computer Orgaizatio ad Desig 1 For the rest of the semester, we ll focus o computer architecture:
More informationPython Programming: An Introduction to Computer Science
Pytho Programmig: A Itroductio to Computer Sciece Chapter 1 Computers ad Programs 1 Objectives To uderstad the respective roles of hardware ad software i a computig system. To lear what computer scietists
More informationLearning to Shoot a Goal Lecture 8: Learning Models and Skills
Learig to Shoot a Goal Lecture 8: Learig Models ad Skills How do we acquire skill at shootig goals? CS 344R/393R: Robotics Bejami Kuipers Learig to Shoot a Goal The robot eeds to shoot the ball i the goal.
More informationClasses and Objects. Again: Distance between points within the first quadrant. José Valente de Oliveira 4-1
Classes ad Objects jvo@ualg.pt José Valete de Oliveira 4-1 Agai: Distace betwee poits withi the first quadrat Sample iput Sample output 1 1 3 4 2 jvo@ualg.pt José Valete de Oliveira 4-2 1 The simplest
More informationIMP: Superposer Integrated Morphometrics Package Superposition Tool
IMP: Superposer Itegrated Morphometrics Package Superpositio Tool Programmig by: David Lieber ( 03) Caisius College 200 Mai St. Buffalo, NY 4208 Cocept by: H. David Sheets, Dept. of Physics, Caisius College
More informationChapter 8. Strings and Vectors. Copyright 2014 Pearson Addison-Wesley. All rights reserved.
Chapter 8 Strigs ad Vectors Overview 8.1 A Array Type for Strigs 8.2 The Stadard strig Class 8.3 Vectors Slide 8-3 8.1 A Array Type for Strigs A Array Type for Strigs C-strigs ca be used to represet strigs
More informationProgramming with Shared Memory PART II. HPC Spring 2017 Prof. Robert van Engelen
Programmig with Shared Memory PART II HPC Sprig 2017 Prof. Robert va Egele Overview Sequetial cosistecy Parallel programmig costructs Depedece aalysis OpeMP Autoparallelizatio Further readig HPC Sprig
More informationCOP4020 Programming Languages. Functional Programming Prof. Robert van Engelen
COP4020 Programmig Laguages Fuctioal Programmig Prof. Robert va Egele Overview What is fuctioal programmig? Historical origis of fuctioal programmig Fuctioal programmig today Cocepts of fuctioal programmig
More information3D Model Retrieval Method Based on Sample Prediction
20 Iteratioal Coferece o Computer Commuicatio ad Maagemet Proc.of CSIT vol.5 (20) (20) IACSIT Press, Sigapore 3D Model Retrieval Method Based o Sample Predictio Qigche Zhag, Ya Tag* School of Computer
More informationPart II. ECHONET Lite. Communication Middleware Specification
II ECHONET Lite Couicatio Middleware Specificatio Date: May 3, 203 Versio.0 Part II ECHONET Lite Couicatio Middleware Specificatio - i - 20 (203) ALL RIGHTS RESERVED II ECHONET Lite Couicatio Middleware
More informationECE4050 Data Structures and Algorithms. Lecture 6: Searching
ECE4050 Data Structures ad Algorithms Lecture 6: Searchig 1 Search Give: Distict keys k 1, k 2,, k ad collectio L of records of the form (k 1, I 1 ), (k 2, I 2 ),, (k, I ) where I j is the iformatio associated
More informationReview: The ACID properties
Recovery Review: The ACID properties A tomicity: All actios i the Xactio happe, or oe happe. C osistecy: If each Xactio is cosistet, ad the DB starts cosistet, it eds up cosistet. I solatio: Executio of
More informationSchema for the DCE Security Registry Server
Schema for the Security egistry Server Versio Date: 0/20/00 For questios or commets cocerig this documet, sed a email ote to dce-ldap@opegroup.org or call Doa Skibbie at 52 838-3896. . Itroductio...3 2.
More informationChapter 1. Introduction to Computers and C++ Programming. Copyright 2015 Pearson Education, Ltd.. All rights reserved.
Chapter 1 Itroductio to Computers ad C++ Programmig Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Overview 1.1 Computer Systems 1.2 Programmig ad Problem Solvig 1.3 Itroductio to C++ 1.4 Testig
More informationAbstract Data Types (ADTs) Stacks. The Stack ADT ( 4.2) Stack Interface in Java
Abstract Data Types (ADTs) tacks A abstract data type (ADT) is a abstractio of a data structure A ADT specifies: Data stored Operatios o the data Error coditios associated with operatios Example: ADT modelig
More informationParsing Techniques. AST Review. AST Data Structures. LL AST Construction. AST Construction CS412/CS413. Introduction to Compilers Tim Teitelbaum
Parsing Techniques C41/C413 Introduction to Compilers Tim Teitelbaum Lecture 11: yntax-directed Definitions February 14, 005 LL parsing Computes a Leftmost derivation Determines the derivation top-down
More informationHere are the coefficients of the terms listed above: 3,5,2,1,1 respectively.
*. Operatios with Poloials: Let s start b defiig soe words. Ter: A ter is a uber, variable or the product of a uber ad variable(s). For eaple:,, z, a Coefficiet: A coefficiet is the ueric factor of the
More informationRecursion. Recursion. Mathematical induction: example. Recursion. The sum of the first n odd numbers is n 2 : Informal proof: Principle:
Recursio Recursio Jordi Cortadella Departmet of Computer Sciece Priciple: Reduce a complex problem ito a simpler istace of the same problem Recursio Itroductio to Programmig Dept. CS, UPC 2 Mathematical
More information% Sun Logo for Frame. X3T10/95-229, Revision 2. September 28, 1995
Su Microsystems, Ic. 2550 Garcia Aveue Moutai View, CA 94045 415 960-1300 X3T10/95-229, Revisio 2 September 28, 1995 % Su Logo for Frame Joh Lohmeyer Chairperso, X3T10 Symbios Logic Ic. 1635 Aeroplaza
More informationn Haskell n Syntax n Lazy evaluation n Static typing and type inference n Algebraic data types n Pattern matching n Type classes
Aoucemets Quiz 7 HW 9 is due o Friday Raibow grades HW 1-6 plus 8. Please, read our commets o 8! Exam 1-2 Quiz 1-6 Ay questios/cocers, let us kow ASAP Last Class Haskell Sytax Lazy evaluatio Static typig
More informationChapter 8. Strings and Vectors. Copyright 2015 Pearson Education, Ltd.. All rights reserved.
Chapter 8 Strigs ad Vectors Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Overview 8.1 A Array Type for Strigs 8.2 The Stadard strig Class 8.3 Vectors Copyright 2015 Pearso Educatio, Ltd..
More information9.1. Sequences and Series. Sequences. What you should learn. Why you should learn it. Definition of Sequence
_9.qxd // : AM Page Chapter 9 Sequeces, Series, ad Probability 9. Sequeces ad Series What you should lear Use sequece otatio to write the terms of sequeces. Use factorial otatio. Use summatio otatio to
More informationMajor CSL Write your name and entry no on every sheet of the answer script. Time 2 Hrs Max Marks 70
NOTE:. Attempt all seve questios. Major CSL 02 2. Write your ame ad etry o o every sheet of the aswer script. Time 2 Hrs Max Marks 70 Q No Q Q 2 Q 3 Q 4 Q 5 Q 6 Q 7 Total MM 6 2 4 0 8 4 6 70 Q. Write a
More informationRecursion. Computer Science S-111 Harvard University David G. Sullivan, Ph.D. Review: Method Frames
Uit 4, Part 3 Recursio Computer Sciece S-111 Harvard Uiversity David G. Sulliva, Ph.D. Review: Method Frames Whe you make a method call, the Java rutime sets aside a block of memory kow as the frame of
More informationInductive Definition to Recursive Function
PDS: CS 11002 Computer Sc & Egg: IIT Kharagpur 1 Iductive Defiitio to Recursive Fuctio PDS: CS 11002 Computer Sc & Egg: IIT Kharagpur 2 Factorial Fuctio Cosider the followig recursive defiitio of the factorial
More informationLecture Notes 6 Introduction to algorithm analysis CSS 501 Data Structures and Object-Oriented Programming
Lecture Notes 6 Itroductio to algorithm aalysis CSS 501 Data Structures ad Object-Orieted Programmig Readig for this lecture: Carrao, Chapter 10 To be covered i this lecture: Itroductio to algorithm aalysis
More informationHeaps. Presentation for use with the textbook Algorithm Design and Applications, by M. T. Goodrich and R. Tamassia, Wiley, 2015
Presetatio for use with the textbook Algorithm Desig ad Applicatios, by M. T. Goodrich ad R. Tamassia, Wiley, 201 Heaps 201 Goodrich ad Tamassia xkcd. http://xkcd.com/83/. Tree. Used with permissio uder
More informationCode Review Defects. Authors: Mika V. Mäntylä and Casper Lassenius Original version: 4 Sep, 2007 Made available online: 24 April, 2013
Code Review s Authors: Mika V. Mätylä ad Casper Lasseius Origial versio: 4 Sep, 2007 Made available olie: 24 April, 2013 This documet cotais further details of the code review defects preseted i [1]. of
More informationBasic allocator mechanisms The course that gives CMU its Zip! Memory Management II: Dynamic Storage Allocation Mar 6, 2000.
5-23 The course that gives CM its Zip Memory Maagemet II: Dyamic Storage Allocatio Mar 6, 2000 Topics Segregated lists Buddy system Garbage collectio Mark ad Sweep Copyig eferece coutig Basic allocator
More informationLast class. n Scheme. n Equality testing. n eq? vs. equal? n Higher-order functions. n map, foldr, foldl. n Tail recursion
Aoucemets HW6 due today HW7 is out A team assigmet Submitty page will be up toight Fuctioal correctess: 75%, Commets : 25% Last class Equality testig eq? vs. equal? Higher-order fuctios map, foldr, foldl
More informationn We have discussed classes in previous lectures n Here, we discuss design of classes n Library design considerations
Chapter 14 Graph class desig Bjare Stroustrup Abstract We have discussed classes i previous lectures Here, we discuss desig of classes Library desig cosideratios Class hierarchies (object-orieted programmig)
More information! Given the following Structure: ! We can define a pointer to a structure. ! Now studentptr points to the s1 structure.
Liked Lists Uit 5 Sectios 11.9 & 18.1-2 CS 2308 Fall 2018 Jill Seama 11.9: Poiters to Structures! Give the followig Structure: struct Studet { strig ame; // Studet s ame it idnum; // Studet ID umber it
More informationCSE 5311 Notes 16: Matrices
CSE 5311 Notes 16: Matrices STRASSEN S MATRIX MULTIPLICATION Matrix additio: takes scalar additios. Everyday atrix ultiply: p p Let = = p. takes p scalar ultiplies ad -1)p scalar additios. Best lower boud
More informationAnalysis Metrics. Intro to Algorithm Analysis. Slides. 12. Alg Analysis. 12. Alg Analysis
Itro to Algorithm Aalysis Aalysis Metrics Slides. Table of Cotets. Aalysis Metrics 3. Exact Aalysis Rules 4. Simple Summatio 5. Summatio Formulas 6. Order of Magitude 7. Big-O otatio 8. Big-O Theorems
More informationThreads and Concurrency in Java: Part 1
Cocurrecy Threads ad Cocurrecy i Java: Part 1 What every computer egieer eeds to kow about cocurrecy: Cocurrecy is to utraied programmers as matches are to small childre. It is all too easy to get bured.
More informationThreads and Concurrency in Java: Part 1
Threads ad Cocurrecy i Java: Part 1 1 Cocurrecy What every computer egieer eeds to kow about cocurrecy: Cocurrecy is to utraied programmers as matches are to small childre. It is all too easy to get bured.
More informationGRADIENT DESCENT. Admin 10/24/13. Assignment 5. David Kauchak CS 451 Fall 2013
Adi Assiget 5 GRADIENT DESCENT David Kauchak CS 451 Fall 2013 Math backgroud Liear odels A strog high-bias assuptio is liear separability: i 2 diesios, ca separate classes by a lie i higher diesios, eed
More informationAbstract. Chapter 4 Computation. Overview 8/13/18. Bjarne Stroustrup Note:
Chapter 4 Computatio Bjare Stroustrup www.stroustrup.com/programmig Abstract Today, I ll preset the basics of computatio. I particular, we ll discuss expressios, how to iterate over a series of values
More informationA graphical view of big-o notation. c*g(n) f(n) f(n) = O(g(n))
ca see that time required to search/sort grows with size of We How do space/time eeds of program grow with iput size? iput. time: cout umber of operatios as fuctio of iput Executio size operatio Assigmet:
More informationOn Infinite Groups that are Isomorphic to its Proper Infinite Subgroup. Jaymar Talledo Balihon. Abstract
O Ifiite Groups that are Isomorphic to its Proper Ifiite Subgroup Jaymar Talledo Baliho Abstract Two groups are isomorphic if there exists a isomorphism betwee them Lagrage Theorem states that the order
More informationGoals of the Lecture Object Constraint Language
Goals of the Lecture Object Costrait Laguage Object-Orieted Aalysis ad Desig - Fall 1998 Preset the Object Costrait Laguage Ð As best as possible, with the limited iformatio available from UML i a Nutshell
More informationChapter 2. C++ Basics. Copyright 2015 Pearson Education, Ltd.. All rights reserved.
Chapter 2 C++ Basics Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Overview 2.1 Variables ad Assigmets 2.2 Iput ad Output 2.3 Data Types ad Expressios 2.4 Simple Flow of Cotrol 2.5 Program
More informationExceptions. Your computer takes exception. The Exception Class. Causes of Exceptions
Your computer takes exceptio s s are errors i the logic of a program (ru-time errors). Examples: i thread mai java.io.filenotfoud: studet.txt (The system caot fid the file specified.) i thread mai java.lag.nullpoiter:
More informationComputational Geometry
Computatioal Geometry Chapter 4 Liear programmig Duality Smallest eclosig disk O the Ageda Liear Programmig Slides courtesy of Craig Gotsma 4. 4. Liear Programmig - Example Defie: (amout amout cosumed
More informationThe Implementation of Data Structures in Version 5 of Icon* Ralph E. Gr is wo Id TR 85-8
The Implemetatio of Data Structures i Versio 5 of Ico* Ralph E. Gr is wo Id TR 85-8 April 1, 1985 Departmet of Computer Sciece The Uiversity of Arizoa Tucso. Arizoa 85721 This work was supported by the
More informationPython Programming: An Introduction to Computer Science
Pytho Programmig: A Itroductio to Computer Sciece Chapter 6 Defiig Fuctios Pytho Programmig, 2/e 1 Objectives To uderstad why programmers divide programs up ito sets of cooperatig fuctios. To be able to
More informationEE260: Digital Design, Spring /16/18. n Example: m 0 (=x 1 x 2 ) is adjacent to m 1 (=x 1 x 2 ) and m 2 (=x 1 x 2 ) but NOT m 3 (=x 1 x 2 )
EE26: Digital Desig, Sprig 28 3/6/8 EE 26: Itroductio to Digital Desig Combiatioal Datapath Yao Zheg Departmet of Electrical Egieerig Uiversity of Hawaiʻi at Māoa Combiatioal Logic Blocks Multiplexer Ecoders/Decoders
More informationFrom last week. Lecture 5. Outline. Principles of programming languages
Priciples of programmig laguages From last week Lecture 5 http://few.vu.l/~silvis/ppl/2007 Natalia Silvis-Cividjia e-mail: silvis@few.vu.l ML has o assigmet. Explai how to access a old bidig? Is & for
More informationFuzzy Transportation Problem Using Triangular Membership Function-A New approach
Vol3 No.. PP 8- March 03 ISSN: 3 006X Trasportatio Proble Usig Triagular Mebership Fuctio-A New approach a S. Solaiappaa* K. Jeyaraab Departet of Matheatics Aa UiversityUiversity College of Egieerig Raaathapura
More informationJCF: case studies. Bruce Eckel, Thinking in Java, 4th edition, PrenticeHall, New Jersey, cf.
JCF: case studies Bruce Eckel, Thikig i Java, 4th editio, PreticeHall, New Jersey, cf. http://midview.et/books/tij4 jvo@ualg.pt José Valete de Oliveira 20-1 CS1: From real to fractio How to covert a real
More informationOnes Assignment Method for Solving Traveling Salesman Problem
Joural of mathematics ad computer sciece 0 (0), 58-65 Oes Assigmet Method for Solvig Travelig Salesma Problem Hadi Basirzadeh Departmet of Mathematics, Shahid Chamra Uiversity, Ahvaz, Ira Article history:
More informationHigh-Performance Matrix-Vector Multiplication on the GPU
High-Perforace Matrix-Vector Multiplicatio o the GPU Has Herik Bradeborg Sørese Iforatics ad Matheatical Modellig, Techical Uiversity of Deark, Bldg., DK-8 Lygby, Deark hhs@i.dtu.dk http//www.gpulab.i.dtu.dk
More informationDEFINITION OF CELL BEHAVIOUR. Actions and Behaviour. CELL = a CELL CELL = b CELL
Actios ad Behaviour Let us start to itroduce some modellig laguage features which will allow us to model the behaviour of a cell compoet. Suppose the cell compoet holds a sigle piece of iformatio which
More informationMinimum Spanning Trees
Miimum Spaig Trees Miimum Spaig Trees Spaig subgraph Subgraph of a graph G cotaiig all the vertices of G Spaig tree Spaig subgraph that is itself a (free) tree Miimum spaig tree (MST) Spaig tree of a weighted
More informationMethod for Solving Unbalanced Transportation Problems Using Trapezoidal Fuzzy Numbers
Kadhirvel. K, Balauruga. K / Iteratioal Joural of Egieerig Research ad Applicatios (IJERA) ISSN: 48-96 www.ijera.co Vol., Issue 4, Jul-Aug 0, pp.59-596 Method for Solvig Ubalaced Trasportatio Probles Usig
More informationData Structures Week #5. Trees (Ağaçlar)
Data Structures Week #5 Trees Ağaçlar) Trees Ağaçlar) Toros Gökarı Avrupa Gökarı October 28, 2014 Boraha Tümer, Ph.D. 2 Trees Ağaçlar) October 28, 2014 Boraha Tümer, Ph.D. 3 Outlie Trees Deiitios Implemetatio
More informationLecture 6. Lecturer: Ronitt Rubinfeld Scribes: Chen Ziv, Eliav Buchnik, Ophir Arie, Jonathan Gradstein
068.670 Subliear Time Algorithms November, 0 Lecture 6 Lecturer: Roitt Rubifeld Scribes: Che Ziv, Eliav Buchik, Ophir Arie, Joatha Gradstei Lesso overview. Usig the oracle reductio framework for approximatig
More informationBluespec-3: Modules & Interfaces. Bluespec: State and Rules organized into modules
Bluespec-3: Modules & Iterfaces Arvid Computer Sciece & Artificial Itelligece Lab Massachusetts Istitute of Techology Based o material prepared by Bluespec Ic, Jauary 2005 February 28, 2005 L09-1 Bluespec:
More informationCMSC Computer Architecture Lecture 12: Virtual Memory. Prof. Yanjing Li University of Chicago
CMSC 22200 Computer Architecture Lecture 12: Virtual Memory Prof. Yajig Li Uiversity of Chicago A System with Physical Memory Oly Examples: most Cray machies early PCs Memory early all embedded systems
More informationBOOLEAN MATHEMATICS: GENERAL THEORY
CHAPTER 3 BOOLEAN MATHEMATICS: GENERAL THEORY 3.1 ISOMORPHIC PROPERTIES The ame Boolea Arithmetic was chose because it was discovered that literal Boolea Algebra could have a isomorphic umerical aspect.
More informationPackage RcppRoll. December 22, 2014
Type Package Package RcppRoll December 22, 2014 Title Fast rollig fuctios through Rcpp ad RcppArmadillo Versio 0.1.0 Date 2013-01-10 Author Kevi Ushey Maitaier Kevi Ushey RcppRoll
More informationLecture 5: Recursion. Recursion Overview. Recursion is a powerful technique for specifying funclons, sets, and programs
CS/ENGRD 20 Object- Orieted Programmig ad Data Structures Sprig 202 Doug James Visual Recursio Lecture : Recursio http://seredip.brymawr.edu/exchage/files/authors/faculty/39/literarykids/ifiite_mirror.jpg!
More informationn Haskell n Covered syntax, lazy evaluation, static typing n Algebraic data types and pattern matching n Type classes n Monads and more n Types
Aoucemets Exam 2 is graded, but I will eed some time to go over it I ll release grades this eveig (figers crossed!) Raibow grades: HW1-6, Exam 1-2, Quiz 1-5 Will post aswer key Still gradig: Quiz 6, HW7
More informationSD vs. SD + One of the most important uses of sample statistics is to estimate the corresponding population parameters.
SD vs. SD + Oe of the most importat uses of sample statistics is to estimate the correspodig populatio parameters. The mea of a represetative sample is a good estimate of the mea of the populatio that
More informationCS Polygon Scan Conversion. Slide 1
CS 112 - Polygo Sca Coversio Slide 1 Polygo Classificatio Covex All iterior agles are less tha 180 degrees Cocave Iterior agles ca be greater tha 180 degrees Degeerate polygos If all vertices are colliear
More informationReliable Transmission. Spring 2018 CS 438 Staff - University of Illinois 1
Reliable Trasmissio Sprig 2018 CS 438 Staff - Uiversity of Illiois 1 Reliable Trasmissio Hello! My computer s ame is Alice. Alice Bob Hello! Alice. Sprig 2018 CS 438 Staff - Uiversity of Illiois 2 Reliable
More informationCS 111: Program Design I Lecture # 7: First Loop, Web Crawler, Functions
CS 111: Program Desig I Lecture # 7: First Loop, Web Crawler, Fuctios Robert H. Sloa & Richard Warer Uiversity of Illiois at Chicago September 18, 2018 What will this prit? x = 5 if x == 3: prit("hi!")
More information