VIEWS: 4 PAGES: 20 POSTED ON: 8/30/2012
The Earley parser Hadier Azhatiguli Plamena Drageva 21 Janurary 2008 Overview The Earley parser without look ahead. Ambiguous sentences. Handling epsilon rules. The prediction look ahead. The reduction look ahead. TOP-DOWN RESTRICTED BREADTH-FIRST BOTTOM-UP PARSING Earley parser can be described as breadth-first top-down parser with bottom-up recognition. Earley parser without look-ahead Earley sets: . We have a set of partial solutions which is modified by each symbol we read.we shall write the sets between input symbols as we go. .The set consists items. Items in the set: It is grammar rule with a gap in its right hand side. The gap is traditionally shown as a fat dot. Earley item: Is an item with an indication of the position of the symbol at which the recognition of the recognized part started. We shall write after the item. Example: The construction of an item set: The construction of item set proceeds in three phases: Scanner. Completer. Predictor. The construction of an item set: .The Scanner ,Completer and Predictor deal with four sets of items for each token. .Input symbol at position p is surrounded by four sets: ,which contains items avaliable just before ; ,the set contains items which have a dot at the end. Construction of an item set: that contains the non-completed items which have a dot in the middle or front ,the set contains newly predicted items which have a dot in front. the set contains active and predicted sets. Scanner: The scanner looks at ,goes through and makes copies all of the items that contains . .Consequently ,the scanner changes into .if dot is at the end ,it stors the item in the completed set ,otherwise in the active set. Completer: Completer inspects the completed set,which contains the items that have just been recognized and can now be reduced. Reduction: This reduction goes as follows: For each item of the form the Completer goes to ,and calls the Scanner. . Scanner will make copies all of the items in featuring a , replacing the by and store them in either completed set or active set. Predictor: Predictor goes through active and predicted sets(which is empity initially) ,and considers all non-terminals which have a dot in front of them. .For each predicted non-terminal N and for each rule for that non-terminal NP the predictor adds an item to the set predicted. If the completed set for the last symbol in the input contains an item ,an item spanning the whole input and reducing to the start symbol,we have found at least one parsing. Example: Input symbol a-a+a Grammar Constructing a parser tree: Constructing a parser tree: Tabulation: In The table : . Columns indicate the begining of possibily recognized fragments,all items with the same come in the same column. . Completed items are drawn in the top left corner of a box,active items in bottom right corner.Predicted items live in the bottom layer.
Pages to are hidden for
"The Early parser"Please download to view full document