views:

45

answers:

1

I would be very glad if someone can make clear for me example mentioned ono wikipedia:

http://en.wikipedia.org/wiki/Earley_algorithm

consider grammar:

P → S      # the start rule
S → S + M | M
M → M * T | T
T → number

and input:

2 + 3 * 4

Earley algorithm works like this:

 (state no.) Production          (Origin) # Comment
 ---------------------------------
 == S(0): • 2 + 3 * 4 ==
 (1)  P → • S         (0)    # start rule
 (2)  S → • S + M     (0)    # predict from (1)
 (3)  S → • M         (0)    # predict from (1)
 (4)  M → • M * T     (0)    # predict from (3)

this is only first set S(0) but my question is: why algorithm is predicting from (3) in step (4) but it ommits prediction from (2)?

I hope somebody understands idea and may help me

+2  A: 

Using (2) for prediction will not create new productions, because the symbol next to the dot is S. Therefore, will would only get the productions (2) and (3) again, which do not add information.

Yuval F
thank you, now i get it
dfens