# Register now to access 7 million high quality study materials (What's Course Hero?) Course Hero is the premier provider of high quality online educational resources. With millions of study documents, online tutors, digital flashcards and free courseware, Course Hero is helping students learn more efficiently and effectively. Whether you're interested in exploring new subjects or mastering key topics for your next exam, Course Hero has the tools you need to achieve your goals.

19 Pages

### sectllparseS

Course: CPS 140, Fall 2009
School: Duke
Rating:

Word Count: 659

#### Document Preview

LL Section: Parsing LL(k) Parser: top-down parser - starts with start symbol on stack, and repeatedly replace nonterminals until string is generated. predictive parser - predict next rewrite rule rst L of LL means - read input string left to right second L of LL means - produces leftmost derivation k - number of lookahead symbols 1 LL parsing process: convert CFG to PDA (dierent method than before) Use...

Register Now

#### Unformatted Document Excerpt

Coursehero >> North Carolina >> Duke >> CPS 140

Course Hero has millions of student submitted documents similar to the one
below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.

Course Hero has millions of student submitted documents similar to the one below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.
LL Section: Parsing LL(k) Parser: top-down parser - starts with start symbol on stack, and repeatedly replace nonterminals until string is generated. predictive parser - predict next rewrite rule rst L of LL means - read input string left to right second L of LL means - produces leftmost derivation k - number of lookahead symbols 1 LL parsing process: convert CFG to PDA (dierent method than before) Use the PDA and lookahead symbols Lookahead symbol is next symbol in input string 2 Convert CFG to NPDA The constructed NPDA: Three states: s, q, f start in state s push S on stack, move into q all rewrite rules in state q: If lhs of rewrite rule on top of stack, replace it with rhs of rewrite rule and stay in state q additional rules in q to recognize nonterminals: read input symbol, pop input symbol, stay in state q pop z from stack, move into f, accept Example: L = {anbbn : n 0} 3 S state = s push(S) state = q read(symbol) while top-of-stack = z do case top-of-stack of S: if symbol == a then {pop(); push(aSb)} else if symbol == b then {pop(); push(b)} else error a: if symbol = a, then error else {pop(); read(symbol)} b: if symbol = b, then error else {pop(); read(symbol)} end case end while pop() if symbol = \$ then error state = f 4 LL Parse Table - 2-dim array rows - variables cols - terminals, \$ (end of string marker) LL[i,j] Example: Parse table for L = {anbbn : n 0} S aSb | b 5 A generic parsing routine push(S) read(symbol) while stack not empty do case top-of-stack of terminal: if top-of-stack == symbol then {pop(); read(symbol)} else error variable: if LL[top-of-stack, symbol] = error then {pop() else push(LL[top-of-stack,symbol])} error end case end while if symbol = \$, then error 6 Example: S aSb Sc a b c \$ S aSb error c error Example: S Ac | Bc A aAb | Bb 7 To construct an LL parse table LL[rows,cols]: 1. For each rule A w (a) For each a in FIRST(w) add w to LL[A,a] (b) If is in FIRST(w) add w to LL[A,b] for each b in FOLLOW(A) 2. Each undened entry is error. 8 Example: S aSc | B Bb| FIRST FOLLOW S a,b, \$,c B b, \$,c To Compute the LL Parse Table for this example: For S aSc, FIRST(aSc) = For S B, FIRST(B) = {b, } FOLLOW(S) = {\$, c} For B b, FIRST(b) = For B FIRST() = 9 LL(1) Parse Table: a b c \$ Parse string: aacc 10 Trace aabcc a a S S S c Stack: S c c c symbol: a a a a S c c b B c c b b c c c c c b c c 11 Example: Construct Parse Table for: S AcB A aAb A B aBb Bc FIRST(A) = FIRST(S) = FIRST(B) = FOLLOW(A) = FOLLOW(S) = FOLLOW(B) = 12 To compute the parse table: For S AcB, FIRST(AcB) = For A aAb, FIRST(aAb) = For A , FIRST()...

Find millions of documents on Course Hero - Study Guides, Lecture Notes, Reference Materials, Practice Exams and more. Course Hero has millions of course specific materials providing students with the best way to expand their education.

Below is a small sample set of documents:

Duke - CPS - 210
Security (part 1)CPS210 Spring 2006Current Forensic MethodsManual inspection of existing logs System, application logsNot enough informationNetwork logMay be encryptedDisk imageOnly shows final stateMachine level logs (ReVirt)No semanti
Duke - CPS - 004
Computer Science 4: Java for Video Gameswww.cs.duke.edu/education/courses/spring06/cps004/ Instructors Dietolf (Dee) Ramm D226 LSRC dr@cs.duke.edu Robert Duvall D228 LSRC rcd@cs.duke.eduCompSci 44.1Introduction Administrative material Int
Duke - CPS - 004
Duke - CPS - 004
Computer Science 4: Java for Video Gameswww.cs.duke.edu/education/courses/spring06/cps004/ Instructors Dietolf (Dee) Ramm D226 LSRC dr@cs.duke.edu Robert Duvall D228 LSRC rcd@cs.duke.eduIntroduction Administrative material Introduction thinki
Duke - CPS - 004
The Plan Graphics Hardware Coordinate System Built-in Shapes User-defined Shapes Sprites and Shapes Making a SpriteCompSci 45.1CompSci 45.2HardwareCoordinate Systems Monitor Resolutions (640x480, 800x600, 1280x1024) Bit
Duke - CPS - 001
Todays topics!Write Your Names(or just exercise your curiosity)!Complexity &quot; Notes from Mason Matthews &quot; Great Ideas Ch. 13 Computability &quot; Great Ideas Ch. 15, Brookshear Ch. 11CPS 00111.1CPS 00111.2What is Computer Science?What c
Duke - CPS - 001
KeyEscrowasaSecurity andRecoveryDevicePresented by: Kevin Ji, Maura Tresch, Eyan Townsend, Whitney Anderson, Turner Rooney, Dan Tulley WhatisaKeyEscrowSystemKey Escrow is the use of a third party (the escrow service) to save and catalog private
UC Davis - LOG - 0503
A Homage toAlfred SchnittkeIrina Schnittke, piano Tatyana Grindenko, violin Alexander Ivashkin, cello Wednesday 30 March 2005, 7.30pmConcert in aid of the Alfred Schnittke Archive in London Sponsored by the Centre for Russian Music, Goldsmiths C
UC Davis - ATT - 0503
A Homage toAlfred SchnittkeIrina Schnittke, piano Tatyana Grindenko, violin Alexander Ivashkin, cello Wednesday 30 March 2005, 7.30pmConcert in aid of the Alfred Schnittke Archive in London Sponsored by the Centre for Russian Music, Goldsmiths C
Duke - STA - 205
Midterm ExaminationSTA 205: Probability and Measure Theory Wednesday, 2005 Mar 9, 2:50-4:05 pmThis is a closed-book examination. You may use a single one-sided sheet of prepared notes, if you wish, but you may not share materials. If a question se
Duke - STA - 216
Bayesian Hypothesis Testing in GLMs: One-Sided and Ordered Alternatives Often interest may focus on comparing a null hypothesis of no dierence between groups to an ordered restricted alternative. For example, we may have a k level ordered categoric
Duke - STA - 103
STA103Probability/Statistical InferenceJenises contact infoInstructor: Jenise Swall Office: 221 Old Chem Bldg. Phone: 684-4608 Office hours: Wed. 9:30PM-10:30PM, Thu. 1:30PM-2:30PM jenise@stat.duke.eduTA contact infoChristine KohnenMickel
Duke - STA - 242
Sta242/Env255, Week 3, 1/23/001Sta242/Env255, Week 3, 1/23/002Week 3: Simple Linear Regression1-way ANOVA: Week 2 Plant ExampleLast class: One-way ANOVA modelsfertilizer levels.Week 3 Reading: Chapter 7, Statistical Sleuth, plus all c
Duke - STA - 293
STA 293B/BGT 08 Expression Analysis Aymetrix expression data See Aymetrix tutorial Expression summaries: AD and ALR, and other information Array normalisation; Hybridisation problems - low levels of intensity One gene: Sample statistics, summari
Duke - STA - 242
6.63 15.04 14.26 15.56 16.83 16.98 14.88 14.37 14.23 15.15 15.74 26.15 26.52 25.84 25.69 26.08 25.32 25.95 26.95 25.57 29.57 36.99 38.77 39.59 37.07 37.7 37.22 37.45 37.89 38.99 38.79 49.35 48.21 48.63 410.33 48.51
Duke - STA - 242
STA242/ENV255 Quiz, 3/7/01 Name:_Page 1 of 3 Total Points (out of 15):_The questions below refer to the bird energy data described on this page. The results below summarize a study of the amount of energy metabolized (in calories) by two similar
Duke - STA - 244
STA2441/22/2001Homework 2Due 1/29/2001 1. (From CB 11.40) Consider the standard simple linear model with normal errors that has been re-parameterized as Yt = Y + t + where t = (X X) so that Y = Y and are independent. Extend Sches procedure
Duke - STA - 242
Week 5, Lec. 1, 2/5/02Week 5, Lec. 1, 2/5/02Regression Parameter EstimatesResiduals: Min 1Q Median 3Q Max -0.339 -0.1071 -0.01023 0.1361 0.3588 Coefficients: (Intercept) log(time) Value Std. Error 6.8115 0.1113 -0.5350 0.0609 t value Pr(&gt;|t|) 6
Duke - STA - 242
W X b i C2f6&quot;egvCvrdvh6iCvY2yvtrr2vCvyr0egvYCgEl2lv ie b u b u b u x w q i x x e b u b n q i ie e e e X X be u b s i u s u b b u v V Cgvvd&amp;v2!add6Y{ V|Xf CYElevCbhCvuYxfwvrCgr)vCy2v02)V|V 2egv26\$vEvd b b b
Duke - STA - 103
( {~ m { zyG}~ 0 G ~ t 0y k m| { 0~ p~m { 0y k { Y ym d dy ~ k { ym d k 2X B T4 RXaa22 D h 0c`C0bbSSIpap4h D2 B q { T4 2 B4 h 2 8 T4 2 22 D 2R Ta H F h h H 2 B4 2 42 1 rW) }0y YbICwD#Q`CSSYSPpHpD`AICQ8 k 5@8 ( Y}pm Y0Y
Duke - STA - 244
APMAM APSAB APSLAKE OPBPC OPRC OPSLAKE Y Year 9.13 3.58 3.91 4.1 7.43 6.47 54235 1948 5.28 4.82 5.2 7.55 11.11 10.26 67567 1949 4.2 3.77 3.67 9.52 12.2 11.35 66161 1950 4.6 4.46 3.93 11.14 15.15 11.13 68094 1951 7.15 4.99 4.88 16.34 20.05 22.81
Duke - STA - 244
BigMac Bread BusFare EngSal EngTax Service TeachSal TeachTax VacDays WorkHrs 31 9 1.27 44.3 44.1 280 21.8 28.2 31.9 1714 33 9 0.27 19.4 23.7 170 9.4 14.8 23.5 1792 98 23 0.09 15.4 20.3 100 2.2 4.3 17.4 2152 131 27 0.09 4.7 37.6 70 1.1 11.7 30.6 2
Duke - STA - 244
Exotic Sire Total Trt 9 1 9 1 5 1 8 2 5 1 8 3 6 1 8 4 3 2 9 1 0 2 9 2 5 2 9 3 5 2 8 4 5 3 8 1 5 3 8 2 6 3 9 3 5 3 6 4 7 4 7 1 7 4 8 2 3 4 6 3 4 4 8 4 8 5 9 1 4 5 8 2 4 5 7 3 6 5 9 4 5 6 9 1 5 6 9 2 4 6 9 3 2 6 7 4 8 7 9 1 4
Duke - STA - 244
Height Length Type 75 502 0 80 522 0 68 425 0 64 344 0 83 407 0 80 451 0 70 551 0 76 530 0 74 547 0 100 519 1 75 225 1 52 300 1 62 418 1 68 409 1 86 425 1 57 370 1 82 506 1 82 506 1 88 295 1 55 273 1 67 415 1 45 182 1 103 530 1
Duke - STA - 244
D F S W 7.2 0 0 10.404 8.2 0 0 18.161 10.3 0 0 25.778 10.1 0 0 20.511 10.7 0 0 21.87 13.3 0 0 47.186 5.1 1 0 4.447 7.2 1 0 8.682 10.2 1 0 19.511 11.3 1 0 37.682 12.6 1 0 25.775 17.1 1 0 67.363 5.1 0 1 4.02 6.5 0 1 7.504 8.4 0 1 13.391
Duke - STA - 244
BodyWt Dose LiverWt y 176 0.88 6.5 0.42 176 0.88 9.5 0.25 190 1 9 0.56 176 0.88 8.9 0.23 200 1 7.2 0.23 167 0.83 8.9 0.32 188 0.94 8 0.37 195 0.98 10 0.41 176 0.88 8 0.33 165 0.84 7.9 0.38 158 0.8 6.9 0.27 148 0.74 7.3 0.36 149 0.75 5.2
Duke - STA - 244
Age Score 15 95 26 71 10 83 9 91 15 102 20 87 18 93 11 100 8 104 20 94 7 113 9 96 10 83 11 84 11 102 10 100 12 105 42 57 17 121 11 86 10 100
Duke - STA - 102
smoke disease sex 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
Duke - STA - 216
CASE STUDY: Bayesian Incidence Analyses from Cross-Sectional Data with Multiple Markers of Disease Severity Outline: 1. NIEHS Uterine Fibroid Study Design of Study Scientific Questions Difficulties 2. General Problem and Earlier Approaches 3. Baye
Duke - STA - 216
Discrete Time Survival Modelsj = P (Ti = j | Ti j, xi) = h(j + xi), where j is the discrete hazard, = (1, . . . , k ) are parameters characterizing the baseline hazard xi are time-independent covariates are regression coecients1Proportional
Duke - STA - 240
Fall 2003'\$1Fall 2003'Exploratory Data AnalysisNematodes 0\$2One-way ANOVA: Example X10.650 10.425 5.600 5.450s2.053 1.486 1.244 1.771How do nematodes (microscopic worms) affect plant growth? A botanist prepares 16 identical p
Duke - STA - 240
www.stat.duke.edu/courses/Fall02/sta240/quiz4/quiz4data.htmlQuiz 4: Lab Exercise, 11/11/02 I will follow the NSEES Honor Code.Name:_ Signature:_1.[3 points] Circle the terms that describe the meadowfoam study: (a) (b) (c) (d) (e) completely r
Duke - STA - 278
STA 278/BGT 208 GENE EXPRESSION ANALYSISStatistical Models, Methods &amp; Computation Mike West Institute of Statistics &amp; Decision Sciences www.isds.duke.edu Computational &amp; Applied Genomics Program www.cagp.duke.eduSTA 278/BGT 208January 12, 2004
Duke - STA - 113
STA 113 Spring 2004 I. H. DinwoodieAssignment 1Due January 29 1. Consider the data in arsenic.txt explained in Arsenic.txt. a. Do a scatter plot of the amount of arsenic in the drinking water in ppm versus theamount in a toenail.b. Find
Duke - STA - 113
0 49 376 726 736 990 2008 2574 2718 2857 2920 3423 3678 3739 4465 4879 5056 5217 6027
Duke - STA - 205
Midterm Examination #1STA 205: Probability and Measure Theory Thursday, 2004 Feb 16, 2:20-3:35 pmThis is a closed-book examination. You may use a single one-sided sheet of prepared notes, if you wish, but you may not share materials. You may use a
Duke - STA - 205
Final ExaminationSTA 205: Probability and Measure Theory Due Monday, 2002 Apr 29, 5:00 pmThis is an open-book take-home examination. You must do your own work- collaboration is not permitted. If a questions seems ambiguous or confusing please ask
Duke - STA - 113
This is from the same paper as the etchratedata.txt file.The 490 measurements in etchratedata.txt were used tocompute a measure of nonuniformity for each of the ten wafers. The nonuniformity is actually the standard deviation of the 49etch ra
Duke - CH - 113
&quot;x1&quot;&quot;x2&quot;&quot;x3&quot;&quot;x4&quot;&quot;y&quot;8410011.42418072.27418014.610712054.97418054.67718014.771314014.65416074.54714034.85110071.481014034.72410031.641018034.56712074.7101318034.84101605
Duke - CH - 113
&quot;C1&quot;&quot;C2&quot;&quot;C3&quot;1.2&quot;pH 3&quot;&quot;Diseased&quot;1.4&quot;pH 3&quot;&quot;Diseased&quot;1&quot;pH 3&quot;&quot;Diseased&quot;1.2&quot;pH 3&quot;&quot;Diseased&quot;1.4&quot;pH 3&quot;&quot;Diseased&quot;.8&quot;pH 5.5&quot;&quot;Diseased&quot;.6&quot;pH 5.5&quot;&quot;Diseased&quot;.8&quot;pH 5.5&quot;&quot;Diseased&quot;1&quot;pH 5.5&quot;&quot;Diseased&quot;.8&quot;pH 5.5&quot;&quot;Diseased&quot;1&quot;pH 7&quot;&quot;Dis
Duke - CH - 113
&quot;response&quot;&quot;type&quot;&quot;subject&quot;12111022733744815926837748919152114321443111411251136124711181329123113421313102483511461217828103910411212923934745101611
Duke - CH - 113
&quot;Obs:&quot;&quot;x:&quot;&quot;y:&quot;1.41.022.421.213.48.884.51.985.571.526.61.837.71.58.751.89.751.7410.781.6311.84212.952.813.992.48141.032.47151.123.05161.153.18171.23.76181.253.68191.253.82201.283.21211.3
Duke - CH - 113
&quot;Linoleic&quot;&quot;Kerosene&quot;&quot;Antiox&quot;&quot;Betacaro&quot;303010.7303010.63303018.41.01340405.049303010.713.183010.120405.04204015.006540205.202303010.6330301.59.04402015.132404015.15303010.73046.8210.34630
Duke - CH - 113
Duke - CH - 113
&quot;stiffness&quot;&quot;plate lengths&quot;309.24409.543114326.54316.84349.84309.74402.16347.263616404.563316348.96381.76392.48366.283518357.18409.98367.383828346.710452.910461.410433.110410.610384.210362.6104
Duke - CH - 113
&quot;temp&quot;&quot;removal%&quot;7.6898.096.5198.256.4397.825.4897.826.5797.8210.2297.9315.6998.3816.7798.8917.1398.9617.6398.916.7298.6815.4598.6912.0698.5111.4498.0910.1798.259.6498.368.5598.277.57986.9498.098.3298.2510.59
Duke - CH - 113
&quot;C1&quot;212401320533132470230421311341232284513150232106421603336123
Duke - CH - 113
&quot;c1&quot;20.919.620.420.320.820.620.520.419.919.819.520.216.518.318.719.6202019.519.619.118.818.317.617.217.818.7191918.618.81918.518.317.516.91717.818.118.818.918.919.118.818.417.81716.817.918.41919.41
Duke - STA - 113
w 88y #zu XQy u w w f8|y zu i a gb i a i j ap r i g r c i r e a n r s tQeA5rqptefet\$eAbIA`Xqp\$ilm8 y e A8q|w q v u y w y 2 w G8G u v|w o8w u s p w e q|X2w2f|w y y y y w y G8G u VG8G u GQtG u G\$G u Ev|w
Duke - STA - 113
p &quot; 8 &quot; &quot; 8 &quot; 1 &quot; U54BA05ih 547#25&amp; &quot; T &amp;U T(0S R)0@&amp;PIHGF )(E&amp;&quot; \$#! D D Q 8 ' % &quot; g F d c F F W a72 2a f@8 &amp;6eR!b2 2a !0`Y&amp;00`Y XV U) 547#25&amp; &quot; 1 &quot; &quot; T &amp;U T(0S R)0@&amp;PIHGF )(E&amp;&quot; \$#! D D Q
Duke - STA - 113
jhi Eu0ihf Q VIr60 ERqCvv U S p I hh p p t U p he i hU Q p i h w Qe h Q i h q h p w s U U p h q p i VIT@uQ (Ro R(h w@9uT(x)40vu44t V(h VI | Q W Q h Q p q p i Q h t W p j pU Q U p I tI @p xt mt' mVxh I4mu Vi k 'x6Sw4e VIrm H V hq Q h q
Duke - STA - 244
STA2441/08/2003Homework 1Due 1/15/2003.Please provide concise, neatly written or typed solutions. All work should be your own and not copied from other texts or sources. Do feel free to discuss questions with me, the TA, others in class, or po
Duke - STA - 113
Students0510152025Range: 69.38% - 96.08%, 84 Students Median = 82.07, Quantiles = [76.36, 86.09] Mean = 81.4, Std Dev = 6.255060708090100Course Averages for STA113
Duke - STA - 205
z V g # &quot; 4 w a F &quot; \$ &amp; B \$ g 0 \$ Q # rSw P6B SiGo1%S1s6E&quot; D E%GEU%651%S1\$ i # Q D \$ # &quot;4 &amp; 2 # 0F &amp; B B # &quot; &amp; B # W B c i # Q w i B W Q # &quot; i B # W B i \$4 B \$ &quot; 0 ( &quot; Q B i4 # &quot;4 \$ # B &amp; @ B B y &amp; \$ B &quot; i CS'S%bU3i G%kfC86EqS
Duke - STA - 103
The data come from http:/www.econstats.com/eq_d1.htm. After the date and day of week they are open high low close return(%)
Duke - STA - 103
The wins (1) and losses (0) of the Philadelphia Phillies in the 2001 season.
Duke - STA - 103
Review of key points about estimators Populations can be at least partially described by population parameters Population parameters include: mean, proportion, variance, etc. Because populations are often very large (maybe innite, like the output
Duke - STA - 216
Frequentist Logistic Regression &amp; ExtensionsReturning to the DDE &amp; Pre-Term Birth Example, recall: yi = 1 for pre-term birth &amp; yi = 0 otherwise di = dose of DDE for woman i zi = vector of covariatesLogistic Regression: logitPr(yi = 1 | xi) =
Duke - STA - 101
21.0 Paired Dierences Answer Questions Paired Dierences Signicance Tests121.1 Paired DierencesExample 1: You want to show that men spend less on Valentines Day than women. You could draw some random men and some random women, ask them what th
Duke - STA - 290
Introduction to Statistical Data AnalysisGiven a new set of data to analyze, how should we proceed? Faced with uncertainty, statistics provides answers to questions and addresses uncertainties p. 1/15Model BuildingWhere should we start? 1. What
Duke - STA - 104
Midterm Examination # 2Mth 135 = Sta 104 Thursday, 2000 November 16, 2:15 3:30 pmIf you dont understand something in one of the questions, please 1 ask me. You may use your own one-sided, 8 2 11 sheet of notes and calculator, but do not share m