ONLINE LEARNING

compiler design

It's all about self learning.

LL(1) Predictive Parser

Non- Recursive Decent Parser, LL(1) parser example, LL(1) parsing algorithm.
18 February, 2016     
A non recursive predictive parser can be built by maintaining a stack explicitly rather than implicitly via recursive call.
LL(1) grammar used for constructing the grammar. First "L" stands for scanning the input from left to right , the second "L" for
 producing a left most derivation , and "1" for using one input symbol of lookahead at each step to make parsing action decisions.
Simple Way to understand the problem::
  1. Push and pop the element from stack.
  2. Pop the top of the stack & increment the input pointer.
  3. If X is nonterminal then we use parsing table M{X,a}.
  4. If M[X,a] = x->uvw then replace x by uvw in the reverse order.
  5. If M[X,a] = blank means ERROR.
In this example , we try to explain how a simple single string is passed by Predictive parser..
Que: Consider   E->TE'
                             T->+TE'/empty
                             T->FT'
                             T'->*FT'/empty
                             F-> (id)|(E)


Solve this question??

Get solution for your websites

logo