ONLINE LEARNING

compiler design

It's all about self learning.

Learn Ambiguity-1

Learn Ambiguous grammar, Derivation Tree, Parse tree
16 February, 2016     
Ambiguous grammar: A sentence generated by a grammar is ambiguous if there exists more than one tree for it . Consider a string y= 3+7*9 of L(G) then more than one tree can be created as follows if the given grammar is 
                         G= {N,T,P,S},N = {E}
                         T={+,*,(,),id}[terminals]
                          P=(E,A)[non-terminals]
See the below image:
  • A derivation in which the rightmost non-terminals is replaced first is called to be right most derivations.
  • A parse tree is a graphical representation of the steps in parsing.
  • A grammar that produces more than one parse tree is said to be ambiguious grammar.

  • To make a parsing of a grammar language we have to eliminate ambiguity , removing left recursion and need left factoring .
Continue in next chapter..

Get solution for your websites

logo