CS241 Lecture Notes - Lecture 5: Donald Knuth, Context-Free Grammar, Parse Tree

58 views9 pages

Document Summary

Additional material by: adriel dean-hall and brad lushman. This handout is intended to accompany the class lectures on bottom. The handout should not be considered a substitute for the lecture. Dissemination of this handout (including posting on a website) is explicitly prohibited unless permission is obtained. We want to state from the input string w and create a reverse derivation to the start symbol s w k k 1 1 s. Shift: consume the next input symbol by pushing it on the stack. Reduce: pop the rhs of a chosen rule o the stack and push its lhs. Input w is: (cid:96) a b y w x (cid:97) At each step in the algorithm there are two choices: shift a character from input to the stack, reduce: take the rhs of some rule o the stack and push the lhs on the stack. The accepting condition is reached when stack contains s" and remaining input is .

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers