CS 314 Principles of Programming Languages
|
|
- Nigel Houston
- 5 years ago
- Views:
Transcription
1 CS 314 Principles of Progrmming Lnguges Lecure 10: Synx Direced Trnslion Zheng (Eddy) Zhng Rugers Universiy Februry 19, 2018
2 Clss Informion Homework 2 is sill being grded. Projec 1 nd homework 4 will be relesed omorrow. 2
3 Review: Recursive Descen Prsing Recursive descen prser for LL(1) Ech non-erminl hs n ssocied prsing procedure h cn recognize ny sequence of okens genered by h non-erminl There is min rouine o iniilize ll globls (e.g:he oken vrible in previous code exmple) nd cll he sr symbol. On reurn, check wheher oken == EOF, nd wheher errors occurred. Wihin prsing procedure, boh non-erminls nd erminls re mched: Non-erminl A: cll procedure for A Token : compre wih curren he firs of he remining okens; If mched, consume inpu, oherwise, ERROR Prsing procedure my conin code h performs some useful compuions (synx direced rnslion) 3
4 Review: Synx Direced Trnslion Exmples: - Inerpreer - Code generor - Type checker - Performnce esimor Use hnd-wrien recursive descen LL(1) prser 4
5 Exmple: he Originl Prser 1: < expr > ::= + < expr > < expr > 2: < digi > 3: < digi > ::= oher < expr > Rule 1 Rule 2 < digi > Rule 3 void expr( ): // reurn vlue of he expression in vl1, vl2; // wo vlues cse +: oken := nex_oken( ); expr( ); expr( ); cse 0..9: digi( ); void digi( ): // reurn vlue of consn cse 1: oken := nex_oken( ); cse 2: oken := nex_oken( ); 5
6 Exmple: Inerpreer 1: < expr > ::= + < expr > < expr > 2: < digi > 3: < digi > ::= oher < expr > Rule 1 Rule 2 < digi > Rule 3 in expr( ) { in vl1, vl2; // wo vlues cse +: oken := nex_oken( ); vl1 = expr( ) ; vl2 = expr( ); reurn vl1 + vl2; cse 0..9: reurn digi( ); // End swich cse //End expr() Inerpreer void expr( ) { cse +: oken := nex_oken( ); expr( ) ; expr( ); cse 0..9: digi( ); // End swich cse //End expr() Originl in digi( ): // reurn vlue of consn cse 1: oken := nex_oken( ); reurn 1; cse 2: oken := nex_oken( ); reurn 2; // End swich cse // End digi( ) void digi( ): // reurn vlue of consn cse 1: oken := nex_oken( ); cse 2: oken := nex_oken( ); // End swich cse // End digi( ) 6
7 Exmple: Inerpreer 1: < expr > ::= + < expr > < expr > 2: < digi > 3: < digi > ::= oher < expr > Rule 1 Rule 2 < digi > Rule 3 in expr( ) { in vl1, vl2; // wo vlues cse +: oken := nex_oken( ); vl1 = expr( ) ; vl2 = expr( ); reurn vl1 + vl2; cse 0..9: reurn digi( ); // End swich cse //End expr() Inerpreer Wh hppens when prsing expression The prsing produces 5 in digi( ): // reurn vlue of consn cse 1: oken := nex_oken( ); reurn 1; cse 2: oken := nex_oken( ); reurn 2; // End swich cse // End digi( ) 7
8 Exmple: Simple Code Generor 1: < expr > ::= + < expr > < expr > 2: < digi > 3: < digi > ::= in expr( ) { in rge_reg; // rge regiser in reg1, reg2; // source regisers cse +: oken := nex_oken( ); rge_reg = nex_regiser( ); reg1 = expr( ) ; reg2 = expr( ); prin_ins(add, reg1, reg2, rge_reg); reurn rge_reg; cse 0..9: reurn digi( ); // End swich cse //End expr() + 09 oher < expr > Rule 1 Rule 2 < digi > Rule 3 Code Generor in digi( ): // reurn vlue of consn in rge_reg; // rge regiser cse 1: oken := nex_oken( ); rge_reg = nex_regiser( ); prin_ins(loadi, 1, rge_reg); reurn rge_reg; cse 2:. // End swich cse // End digi( ) 8
9 Exmple: Simple Code Generor 1: < expr > ::= + < expr > < expr > 2: < digi > 3: < digi > ::= in expr( ) { in rge_reg; // rge regiser in reg1, reg2; // source regisers cse +: oken := nex_oken( ); rge_reg = nex_regiser( ); reg1 = expr( ) ; reg2 = expr( ); prin_ins(add, reg1, reg2, rge_reg); reurn rge_reg; cse 0..9: reurn digi( ); // End swich cse //End expr() + 09 oher < expr > Rule 1 Rule 2 < digi > Rule 3 Code Generor in digi( ): // reurn vlue of consn in rge_reg; // rge regiser cse 1: oken := nex_oken( ); rge_reg = nex_regiser( ); prin_ins(loadi, 1, rge_reg); reurn rge_reg; cse 2:. // End swich cse // End digi( ) ADD r<reg1>, r<reg2> => r<rge_reg> 9
10 Exmple: Simple Code Generor 1: < expr > ::= + < expr > < expr > 2: < digi > 3: < digi > ::= in expr( ) { in rge_reg; // rge regiser in reg1, reg2; // source regisers cse +: oken := nex_oken( ); rge_reg = nex_regiser( ); reg1 = expr( ) ; reg2 = expr( ); prin_ins(add, reg1, reg2, rge_reg); reurn rge_reg; cse 0..9: reurn digi( ); // End swich cse //End expr() + 09 oher < expr > Rule 1 Rule 2 < digi > Rule 3 Code Generor in digi( ): // reurn vlue of consn in rge_reg; // rge regiser cse 1: oken := nex_oken( ); rge_reg = nex_regiser( ); prin_ins(loadi, 1, rge_reg); reurn rge_reg; cse 2:. // End swich cse // End digi( ) LOADI 1 => r<rge_reg> 10
11 Exmple: Code Generor (con.) Wh hppens when you prse he progrm: ? Firs cll o nex_regiser() will reurn 1 in expr( ) { in rge_reg; // rge regiser in reg1, reg2; // source regisers cse +: oken := nex_oken( ); rge_reg = nex_regiser( ); reg1 = expr( ) ; reg2 = expr( ); prin_ins(add, reg1, reg2, rge_reg); reurn rge_reg; cse 0..9: reurn digi( ); // End swich cse //End expr() The prsing produces: LOADI 2 => r2 LOADI 1 => r4 LOADI 2 => r5 ADD r4, r5 => r3 ADD r2, r3 => r1 in digi( ): // reurn vlue of consn in rge_reg; // rge regiser cse 1: oken := nex_oken( ); rge_reg = nex_regiser( ); prin_ins(loadi, 1, rge_reg); reurn rge_reg; cse 2:. // End swich cse // End digi( ) 11
12 Exmple: Type Checker 1: < expr > ::= + < expr > < expr > 2: < digi > 3: < digi > ::= oher < expr > Rule 1 Rule 2 < digi > Rule 3 sring expr( ) { // reurns ype expression sring ype1, ype2; // oher ype expressions cse +: oken := nex_oken( ); ype1 = expr( ); ype2 = expr( ); if (ype1 == in && ype2 == in ){ reurn in ; else{ reurn error ; cse 0..9: reurn digi ( ); sring digi( ) { // reurns ype expression cse 1: oken := nex_oken( ); reurn in ; cse 2: oken := nex_oken( ); reurn in ; 12
13 Exmple: Type Checker (con.) Wh hppens when you prse subprogrm ? The prsing produces: in 13
14 Exmple: Bsic Performnce Predicor 1: < expr > ::= + < expr > < expr > 2: < digi > 3: < digi > ::= oher < expr > Rule 1 Rule 2 < digi > Rule 3 in expr( ) { // reurns cycles in cyc1, cyc2; // subexpression cycles cse +: oken := nex_oken ( ) cyc1 = expr( ); cyc2 = expr( ); // ADD kes 2 cycles reurn cyc1 + cyc2 + 2; cse 0..9: reurn digi ( ); in digi( ) { // reurns cycles cse 1: oken := nex_oken ( ); reurn 1; // LOADI kes 1 cycle cse 2: oken := nex_oken ( ); reurn 1; // LOADI kes 1 cycle 14
15 Exmple: Bsic Performnce Predicor (con.) Wh hppens when you prse subprogrm ? The prsing produces: 7 ADD kes 2 cycles LOADI kes 1 cycle 15
16 Imperive Progrmming Lnguge Imperive: Sequence of se-chnging cions. Mnipule n bsrc mchine wih: 1. Vribles nming memory locions 2. Arihmeic nd logicl operions 3. Reference, evlue, ssign operions 4. Explici conrol flow semens Key operions: Assignmen nd conrol flow Fis he Von Neumnn rchiecure closely 16
17 Run-ime Sorge Orgnizion Typicl memory lyou S c k H e p C o d e S i c & G l o b l Mos Lnguge runime lyou he ddress spce in similr wy Pieces (sck, hep, code & globls) my move, bu ll will be here Sck nd hep grow owrd ech oher Arrys live on one of he scks, in he globl re, or in he hep 17
18 Sck vs Hep Sck: Procedure civions, siclly lloced locl vribles, prmeer vlues Lifeime sme s subrouine in which vribles re declred Sck frme is pushed wih ech invocion of subrouine, nd popped fer subrouine exi Hep: Dynmiclly lloced d srucure, whose size my no be known in dvnce Lifeime exends beyond subrouine in which hey re creed Mus be explicily freed or grbge colleced 18
19 How Does Address Spce Mpping Work? 19 The big picure Compiler s view S c k H e p C o d e S i c G l o b l S c k H e p G l o b l G l o b l G l o b l S c k S c k C o d e C o d e H e p H e p C o d e S i c S i c S i c & & & & virul ddress spces OS s view TLB 0 high physicl ddress spce TLB is n ddress cche used by he OS o speed virul-o-physicl ddress rnslion. A process my hve >1 level TLB
20 Nex Lecure Things o do: Sr progrmming in C. Red Sco, Chper ; ALSU Nex ime: - Procedure bsrcions; Runime sck; Scoping 20
Procedure 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 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 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 informationStacking Tags in LLC Media
Scking Tgs in LL Medi Normn Finn ugus 19, 2013 Ver. 2 (This presenion is lso uploded o 802.11 documen sysem s documen number 2013-0952-1.) bz-nfinn-ll-g-scking-0813-v01 IEEE 802.1 inerim meeing, Sep. 2013,
More informationCSE 401 Midterm Exam 11/5/10 Sample Solution
Question 1. egulr expressions (20 points) In the Ad Progrmming lnguge n integer constnt contins one or more digits, but it my lso contin embedded underscores. Any underscores must be preceded nd followed
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 informationClass Information ANNOUCEMENTS
Class Information ANNOUCEMENTS Third homework due Friday, October 13, 11:59pm. First project will be posted soon. Midterm exam: Friday, October 27, in class. Don t forget to work on your C and Linux skills
More information10/12/17. Motivating Example. Lexical and Syntax Analysis (2) Recursive-Descent Parsing. Recursive-Descent Parsing. Recursive-Descent Parsing
Motivting Exmple Lexicl nd yntx Anlysis (2) In Text: Chpter 4 Consider the grmmr -> cad A -> b Input string: w = cd How to build prse tree top-down? 2 Initilly crete tree contining single node (the strt
More informationCS 314 Principles of Programming Languages. Lecture 9
CS 314 Principles of Programming Languages Lecture 9 Zheng Zhang Department of Computer Science Rutgers University Wednesday 5 th October, 2016 Zheng Zhang 1 CS@Rutgers University Class Information Homework
More informationCompilers Spring 2013 PRACTICE Midterm Exam
Compilers Spring 2013 PRACTICE Midterm Exm This is full length prctice midterm exm. If you wnt to tke it t exm pce, give yourself 7 minutes to tke the entire test. Just like the rel exm, ech question hs
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 informationCS 430 Spring Mike Lam, Professor. Parsing
CS 430 Spring 2015 Mike Lm, Professor Prsing Syntx Anlysis We cn now formlly descrie lnguge's syntx Using regulr expressions nd BNF grmmrs How does tht help us? Syntx Anlysis We cn now formlly descrie
More informationData sharing in OpenMP
Dt shring in OpenMP Polo Burgio polo.burgio@unimore.it Outline Expressing prllelism Understnding prllel threds Memory Dt mngement Dt cluses Synchroniztion Brriers, locks, criticl sections Work prtitioning
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 informationHomework. Context Free Languages III. Languages. Plan for today. Context Free Languages. CFLs and Regular Languages. Homework #5 (due 10/22)
Homework Context Free Lnguges III Prse Trees nd Homework #5 (due 10/22) From textbook 6.4,b 6.5b 6.9b,c 6.13 6.22 Pln for tody Context Free Lnguges Next clss of lnguges in our quest! Lnguges Recll. Wht
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 informationCOMP26120: Algorithms and Imperative Programming
COMP26120 ecure C3 1/48 COMP26120: Algorihms and Imperaive Programming ecure C3: C - Recursive Daa Srucures Pee Jinks School of Compuer Science, Universiy of Mancheser Auumn 2011 COMP26120 ecure C3 2/48
More informationSome Thoughts on Grad School. Undergraduate Compilers Review and Intro to MJC. Structure of a Typical Compiler. Lexing and Parsing
Undergrdute Compilers Review nd Intro to MJC Announcements Miling list is in full swing Tody Some thoughts on grd school Finish prsing Semntic nlysis Visitor pttern for bstrct syntx trees Some Thoughts
More informationEliminating left recursion grammar transformation. The transformed expression grammar
Eliminting left recursion grmmr trnsformtion Originl! rnsformed! 0 0! 0 α β α α α α α α α α β he two grmmrs generte the sme lnguge, but the one on the right genertes the rst, nd then string of s, using
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 informationToday. Quiz Introduction to pipelining
Pipelining 1 Tody Quiz Inroduion o pipelining 2 Pipelining 10ns (10ns) 20ns (10ns) 30ns (10ns) Wh s he leny for one uni of work? Wh s he hroughpu? Pipelining 1.Brek up he logi wih lhes ino pipeline sges
More informationCS 321 Programming Languages and Compilers. Bottom Up Parsing
CS 321 Progrmming nguges nd Compilers Bottom Up Prsing Bottom-up Prsing: Shift-reduce prsing Grmmr H: fi ; fi b Input: ;;b hs prse tree ; ; b 2 Dt for Shift-reduce Prser Input string: sequence of tokens
More informationOperator Precedence. Java CUP. E E + T T T * P P P id id id. Does a+b*c mean (a+b)*c or
Opertor Precedence Most progrmming lnguges hve opertor precedence rules tht stte the order in which opertors re pplied (in the sence of explicit prentheses). Thus in C nd Jv nd CSX, +*c mens compute *c,
More informationIn the last lecture, we discussed how valid tokens may be specified by regular expressions.
LECTURE 5 Scnning SYNTAX ANALYSIS We know from our previous lectures tht the process of verifying the syntx of the progrm is performed in two stges: Scnning: Identifying nd verifying tokens in progrm.
More informationCOMP 423 lecture 11 Jan. 28, 2008
COMP 423 lecture 11 Jn. 28, 2008 Up to now, we hve looked t how some symols in n lphet occur more frequently thn others nd how we cn sve its y using code such tht the codewords for more frequently occuring
More informationProblem Set 2 Fall 16 Due: Wednesday, September 21th, in class, before class begins.
Problem Set 2 Fll 16 Due: Wednesdy, September 21th, in clss, before clss begins. 1. LL Prsing For the following sub-problems, consider the following context-free grmmr: S T$ (1) T A (2) T bbb (3) A T (4)
More information12 <= rm <digit> 2 <= rm <no> 2 <= rm <no> <digit> <= rm <no> <= rm <number>
DDD16 Compilers nd Interpreters DDB44 Compiler Construction R Prsing Prt 1 R prsing concept Using prser genertor Prse ree Genertion Wht is R-prsing? eft-to-right scnning R Rigthmost derivtion in reverse
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 informationFall 2018 Midterm 1 October 11, ˆ You may not ask questions about the exam except for language clarifications.
15-112 Fll 2018 Midterm 1 October 11, 2018 Nme: Andrew ID: Recittion Section: ˆ You my not use ny books, notes, extr pper, or electronic devices during this exm. There should be nothing on your desk or
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 informationCMPSC 470: Compiler Construction
CMPSC 47: Compiler Construction Plese complete the following: Midterm (Type A) Nme Instruction: Mke sure you hve ll pges including this cover nd lnk pge t the end. Answer ech question in the spce provided.
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 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 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 informationDefinition of Regular Expression
Definition of Regulr Expression After the definition of the string nd lnguges, we re redy to descrie regulr expressions, the nottion we shll use to define the clss of lnguges known s regulr sets. Recll
More informationEngineer To Engineer Note
Engineer To Engineer Note EE-186 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 informationMidterm I Solutions CS164, Spring 2006
Midterm I Solutions CS164, Spring 2006 Februry 23, 2006 Plese red ll instructions (including these) crefully. Write your nme, login, SID, nd circle the section time. There re 8 pges in this exm nd 4 questions,
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 informationCOMPUTER SCIENCE 123. Foundations of Computer Science. 6. Tuples
COMPUTER SCIENCE 123 Foundtions of Computer Science 6. Tuples Summry: This lecture introduces tuples in Hskell. Reference: Thompson Sections 5.1 2 R.L. While, 2000 3 Tuples Most dt comes with structure
More informationTopic 2: Lexing and Flexing
Topic 2: Lexing nd Flexing COS 320 Compiling Techniques Princeton University Spring 2016 Lennrt Beringer 1 2 The Compiler Lexicl Anlysis Gol: rek strem of ASCII chrcters (source/input) into sequence of
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 informationPART 1 REFERENCE INFORMATION CONTROL DATA 6400 SYSTEMS CENTRAL PROCESSOR MONITOR
. ~ PART 1 c 0 \,).,,.,, REFERENCE NFORMATON CONTROL DATA 6400 SYSTEMS CENTRAL PROCESSOR MONTOR n CONTROL DATA 6400 Compuer Sysems, sysem funcions are normally handled by he Monior locaed in a Peripheral
More informationMARSS Reference Sheet
MARSS Reference Shee The defaul MARSS model (form="marxss") is wrien as follows: x = B x 1 + u + C c + w where w MVN( Q ) y = Z x + a + D d + v where v MVN( R ) x 1 MVN(π Λ) or x MVN(π Λ) c and d are inpus
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 informationCaches I. CSE 351 Autumn Instructor: Justin Hsia
L01: Intro, L01: L16: Combintionl Introduction Cches I Logic CSE369, CSE351, Autumn 2016 Cches I CSE 351 Autumn 2016 Instructor: Justin Hsi Teching Assistnts: Chris M Hunter Zhn John Kltenbch Kevin Bi
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 informationCMSC 331 First Midterm Exam
0 00/ 1 20/ 2 05/ 3 15/ 4 15/ 5 15/ 6 20/ 7 30/ 8 30/ 150/ 331 First Midterm Exm 7 October 2003 CMC 331 First Midterm Exm Nme: mple Answers tudent ID#: You will hve seventy-five (75) minutes to complete
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 informationData Flow on a Queue Machine. Bruno R. Preiss. Copyright (c) 1987 by Bruno R. Preiss, P.Eng. All rights reserved.
Dt Flow on Queue Mchine Bruno R. Preiss 2 Outline Genesis of dt-flow rchitectures Sttic vs. dynmic dt-flow rchitectures Pseudo-sttic dt-flow execution model Some dt-flow mchines Simple queue mchine Prioritized
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 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 informationASTs, Regex, Parsing, and Pretty Printing
ASTs, Regex, Prsing, nd Pretty Printing CS 2112 Fll 2016 1 Algeric Expressions To strt, consider integer rithmetic. Suppose we hve the following 1. The lphet we will use is the digits {0, 1, 2, 3, 4, 5,
More informationIST 220: Ch3-Transport Layer
ST 220: Ch3-Trns Lyer Abdullh Konk School of nformtion Sciences nd Technology Penn Stte Berks Lerning Objectives. Understnd position of trns lyer in nternet model. Understnd rtionle for extence of trns
More informationLexical Analysis: Constructing a Scanner from Regular Expressions
Lexicl Anlysis: Constructing Scnner from Regulr Expressions Gol Show how to construct FA to recognize ny RE This Lecture Convert RE to n nondeterministic finite utomton (NFA) Use Thompson s construction
More informationECE 468/573 Midterm 1 September 28, 2012
ECE 468/573 Midterm 1 September 28, 2012 Nme:! Purdue emil:! Plese sign the following: I ffirm tht the nswers given on this test re mine nd mine lone. I did not receive help from ny person or mteril (other
More informationCEE598 - Visual Sensing for Civil Infrastructure Eng. & Mgmt.
CEE598 - Visul Sensing for Civil Infrsrucure Eng. & Mgm. Session 2 Review of Liner Algebr nd Geomeric Trnsformions Mni Golprvr-Frd Deprmen of Civil nd Environmenl Engineering Deprmen of Compuer Science
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 informationMath 142, Exam 1 Information.
Mth 14, Exm 1 Informtion. 9/14/10, LC 41, 9:30-10:45. Exm 1 will be bsed on: Sections 7.1-7.5. The corresponding ssigned homework problems (see http://www.mth.sc.edu/ boyln/sccourses/14f10/14.html) At
More informationVery sad code. Abstraction, List, & Cons. CS61A Lecture 7. Happier Code. Goals. Constructors. Constructors 6/29/2011. Selectors.
6/9/ Abstrction, List, & Cons CS6A Lecture 7-6-9 Colleen Lewis Very sd code (define (totl hnd) (if (empty? hnd) (+ (butlst (lst hnd)) (totl (butlst hnd))))) STk> (totl (h c d)) 7 STk> (totl (h ks d)) ;;;EEEK!
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 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 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 informationLING/C SC/PSYC 438/538. Lecture 21 Sandiway Fong
LING/C SC/PSYC 438/538 Lecture 21 Sndiwy Fong Tody's Topics Homework 8 Review Optionl Homework 9 (mke up on Homework 7) Homework 8 Review Question1: write Prolog regulr grmmr for the following lnguge:
More informationJava CUP. Java CUP Specifications. User Code Additions. Package and Import Specifications
Jv CUP Jv CUP is prser-genertion tool, similr to Ycc. CUP uilds Jv prser for LALR(1) grmmrs from production rules nd ssocited Jv code frgments. When prticulr production is recognized, its ssocited code
More informationGrade 11 Physics Homework 3. Be prepared to defend your choices in class!
Gre 11 Physics Homework 3 Be prepre o efen your choices in clss! 1. The grph shows he riion wih ime of he elociy of n objec. Which one of he following grphs bes represens he riion wih ime of he ccelerion
More informationCaches I. CSE 351 Spring Instructor: Ruth Anderson
L16: Cches I Cches I CSE 351 Spring 2017 Instructor: Ruth Anderson Teching Assistnts: Dyln Johnson Kevin Bi Linxing Preston Jing Cody Ohlsen Yufng Sun Joshu Curtis L16: Cches I Administrivi Homework 3,
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 informationLecture 7: Building 3D Models (Part 1) Prof Emmanuel Agu. Computer Science Dept. Worcester Polytechnic Institute (WPI)
Computer Grphics (CS 4731) Lecture 7: Building 3D Models (Prt 1) Prof Emmnuel Agu Computer Science Dept. Worcester Polytechnic Institute (WPI) Stndrd d Unit itvectors Define y i j 1,0,0 0,1,0 k i k 0,0,1
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 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 informationCS 432 Fall Mike Lam, Professor a (bc)* Regular Expressions and Finite Automata
CS 432 Fll 2017 Mike Lm, Professor (c)* Regulr Expressions nd Finite Automt Compiltion Current focus "Bck end" Source code Tokens Syntx tree Mchine code chr dt[20]; int min() { flot x = 42.0; return 7;
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 informationComplete Coverage Path Planning of Mobile Robot Based on Dynamic Programming Algorithm Peng Zhou, Zhong-min Wang, Zhen-nan Li, Yang Li
2nd Interntionl Conference on Electronic & Mechnicl Engineering nd Informtion Technology (EMEIT-212) Complete Coverge Pth Plnning of Mobile Robot Bsed on Dynmic Progrmming Algorithm Peng Zhou, Zhong-min
More informationCSCE 531, Spring 2017, Midterm Exam Answer Key
CCE 531, pring 2017, Midterm Exm Answer Key 1. (15 points) Using the method descried in the ook or in clss, convert the following regulr expression into n equivlent (nondeterministic) finite utomton: (
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 informationData Structures and Algorithms. The material for this lecture is drawn, in part, from The Practice of Programming (Kernighan & Pike) Chapter 2
Daa Srucures and Algorihms The maerial for his lecure is drawn, in par, from The Pracice of Programming (Kernighan & Pike) Chaper 2 1 Moivaing Quoaion Every program depends on algorihms and daa srucures,
More information1 Quad-Edge Construction Operators
CS48: Computer Grphics Hndout # Geometric Modeling Originl Hndout #5 Stnford University Tuesdy, 8 December 99 Originl Lecture #5: 9 November 99 Topics: Mnipultions with Qud-Edge Dt Structures Scribe: Mike
More informationMidterm Exam Announcements
Miderm Exam Noe: This was a challenging exam. CSCI 4: Principles o Programming Languages Lecure 1: Excepions Insrucor: Dan Barowy Miderm Exam Scores 18 16 14 12 10 needs improvemen 8 6 4 2 0 0-49 50-59
More informationCS553 Lecture Introduction to Data-flow Analysis 1
! Ide Introdution to Dt-flow nlysis!lst Time! Implementing Mrk nd Sweep GC!Tody! Control flow grphs! Liveness nlysis! Register llotion CS553 Leture Introdution to Dt-flow Anlysis 1 Dt-flow Anlysis! Dt-flow
More informationRegister Transfer Level (RTL) Design
CSE4: Components nd Design Techniques for Digitl Systems Register Trnsfer Level (RTL) Design Tjn Simunic Rosing Where we re now Wht we hve covered lst time: Register Trnsfer Level (RTL) design Wht we re
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 informationΕΠΛ323 - Θεωρία και Πρακτική Μεταγλωττιστών
ΕΠΛ323 - Θωρία και Πρακτική Μταγλωττιστών Lecture 3 Lexicl Anlysis Elis Athnsopoulos elisthn@cs.ucy.c.cy Recognition of Tokens if expressions nd reltionl opertors if è if then è then else è else relop
More information10/9/2012. Operator is an operation performed over data at runtime. Arithmetic, Logical, Comparison, Assignment, Etc. Operators have precedence
/9/22 P f Performing i Si Simple l Clcultions C l l ti with ith C#. Opertors in C# nd Opertor Precedence 2. Arithmetic Opertors 3. Logicl Opertors 4. Bitwise Opertors 5. Comprison Opertors 6. Assignment
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 informationLEX5: Regexps to NFA. Lexical Analysis. CMPT 379: Compilers Instructor: Anoop Sarkar. anoopsarkar.github.io/compilers-class
LEX5: Regexps to NFA Lexicl Anlysis CMPT 379: Compilers Instructor: Anoop Srkr noopsrkr.github.io/compilers-clss Building Lexicl Anlyzer Token POern POern Regulr Expression Regulr Expression NFA NFA DFA
More informationCaches I. CSE 351 Autumn 2018
Cches I CSE 351 Autumn 2018 Instructors: Mx Willsey Luis Ceze Teching Assistnts: Britt Henderson Luks Joswik Josie Lee Wei Lin Dniel Snitkovsky Luis Veg Kory Wtson Ivy Yu Alt text: I looked t some of the
More informationSlides for Data Mining by I. H. Witten and E. Frank
Slides for Dt Mining y I. H. Witten nd E. Frnk Simplicity first Simple lgorithms often work very well! There re mny kinds of simple structure, eg: One ttriute does ll the work All ttriutes contriute eqully
More informationCS 340, Fall 2014 Dec 11 th /13 th Final Exam Note: in all questions, the special symbol ɛ (epsilon) is used to indicate the empty string.
CS 340, Fll 2014 Dec 11 th /13 th Finl Exm Nme: Note: in ll questions, the specil symol ɛ (epsilon) is used to indicte the empty string. Question 1. [5 points] Consider the following regulr expression;
More informationScope, 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 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 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 informationCS 152 Computer Architecture and Engineering. Lecture 7 - Memory Hierarchy-II
CS 152 Compuer Archiecure and Engineering Lecure 7 - Memory Hierarchy-II Krse Asanovic Elecrical Engineering and Compuer Sciences Universiy of California a Berkeley hp://www.eecs.berkeley.edu/~krse hp://ins.eecs.berkeley.edu/~cs152
More informationΕΠΛ323 - Θεωρία και Πρακτική Μεταγλωττιστών. Lecture 3b Lexical Analysis Elias Athanasopoulos
ΕΠΛ323 - Θωρία και Πρακτική Μταγλωττιστών Lecture 3 Lexicl Anlysis Elis Athnsopoulos elisthn@cs.ucy.c.cy RecogniNon of Tokens if expressions nd relnonl opertors if è if then è then else è else relop è
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 informationAnnouncements. CS 188: Artificial Intelligence Fall Recap: Search. Today. General Tree Search. Uniform Cost. Lecture 3: A* Search 9/4/2007
CS 88: Artificil Intelligence Fll 2007 Lecture : A* Serch 9/4/2007 Dn Klein UC Berkeley Mny slides over the course dpted from either Sturt Russell or Andrew Moore Announcements Sections: New section 06:
More informationExam #1 for Computer Simulation Spring 2005
Exm # for Computer Simultion Spring 005 >>> SOLUTION
More informationOutline. EECS Components and Design Techniques for Digital Systems. Lec 06 Using FSMs Review: Typical Controller: state
Ouline EECS 5 - Componens and Design Techniques for Digial Sysems Lec 6 Using FSMs 9-3-7 Review FSMs Mapping o FPGAs Typical uses of FSMs Synchronous Seq. Circuis safe composiion Timing FSMs in verilog
More informationDistributed Systems Principles and Paradigms
Distriuted Systems Principles nd Prdigms Chpter 11 (version April 7, 2008) Mrten vn Steen Vrije Universiteit Amsterdm, Fculty of Science Dept. Mthemtics nd Computer Science Room R4.20. Tel: (020) 598 7784
More informationLecture 10 Splines Introduction to Splines
ES8 Economerics. Inroducion o Splines. Esiming Spline Mehod One. Esiming Spline Mehod To.4 Cuic Splines Lecure Splines. Inroducion o Splines Firs pplied Poirier & Grer (974) in sud of profi res in hree
More information6.3 Volumes. Just as area is always positive, so is volume and our attitudes towards finding it.
6.3 Volumes Just s re is lwys positive, so is volume nd our ttitudes towrds finding it. Let s review how to find the volume of regulr geometric prism, tht is, 3-dimensionl oject with two regulr fces seprted
More information