CFG (Context Free Grammer)
It has 4 parameters
#Starting Symbols : Denotes first symbol of Grammer
#Set of Terminals : Represented by small letters they are alphabets or we can say end point of grammar
#Set of non-Terminals :Represented by capital letters they give rise to production.
#Production rules: Rules which govern the Grammer.
There is two type of parsing done in this
*Left-most parsing: where evaluation of string starts from left side
*Right-most parsing: where evaluation of string starts from right side
$ if an equal string is obtained by any of the parsings(right/left) then that string is called ambiguous.
& to remove the ambiguity we do the following :
1. Removing useless symbols: any non-terminal which does not accompany terminal should be removed.
2. Removing unit Production: if non-terminal follow transition rule then middle should be removed.
3. Epsilon Transition: epsilon symbol should be replaced with the corresponding terminal symbol.
CNF(Chomsky Normal Form)
It has two rules
# A non-terminal can give rise to only one terminal.
# A non-terminal can give rise to two non-Terminals.
It has 4 parameters
#Starting Symbols : Denotes first symbol of Grammer
#Set of Terminals : Represented by small letters they are alphabets or we can say end point of grammar
#Set of non-Terminals :Represented by capital letters they give rise to production.
#Production rules: Rules which govern the Grammer.
There is two type of parsing done in this
*Left-most parsing: where evaluation of string starts from left side
*Right-most parsing: where evaluation of string starts from right side
$ if an equal string is obtained by any of the parsings(right/left) then that string is called ambiguous.
& to remove the ambiguity we do the following :
1. Removing useless symbols: any non-terminal which does not accompany terminal should be removed.
2. Removing unit Production: if non-terminal follow transition rule then middle should be removed.
3. Epsilon Transition: epsilon symbol should be replaced with the corresponding terminal symbol.
CNF(Chomsky Normal Form)
It has two rules
# A non-terminal can give rise to only one terminal.
# A non-terminal can give rise to two non-Terminals.
No comments:
Post a Comment