The Earley parser - PowerPoint PPT Presentation

1 / 20
About This Presentation
Title:

The Earley parser

Description:

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. ... – PowerPoint PPT presentation

Number of Views:386
Avg rating:3.0/5.0
Slides: 21
Provided by: yasen
Category:

less

Transcript and Presenter's Notes

Title: The Earley parser


1
The Earley parser
  • Hadier Azhatiguli
  • Plamena Drageva
  • 21 Janurary 2008

2
Overview
  • The Earley parser without look ahead.
  • Ambiguous sentences.
  • Handling epsilon rules.
  • The prediction look ahead.
  • The reduction look ahead.

3
TOP-DOWN RESTRICTED BREADTH-FIRST
BOTTOM-UP PARSING
  • Earley parser can be described as breadth-first
    top-down parser with bottom-up recognition.

4
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.

5
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.

6
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

7
The construction of an item set
  • The construction of item set proceeds in three
    phases
  • Scanner.
  • Completer.
  • Predictor.

8
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.

9
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.

10
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.

11
Completer
  • Completer inspects the completed set,which
    contains the items that have just been
    recognized and can now be reduced.

12
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.

13
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 N?P
  • the predictor adds an item
  • to the set predicted.

14
  • 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.

15
Example
  • Input symbol a-aa
  • Grammar

16
(No Transcript)
17
Constructing a parser tree
18
Constructing a parser tree
19
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.

20
(No Transcript)
Write a Comment
User Comments (0)
About PowerShow.com