Successfully reported this slideshow.

1 of 2 Ad

# Develop leftmost and rightmost derivations respectively for the Identi.docx

Develop leftmost and rightmost derivations respectively for the Identifier value ab56c78, using the following BNF syntax:
Identifier -> Identifier { Letter | Digit } | Letter
Letter -> a | b | â€¦ | z | A | B | â€¦ | Z
Digit -> 0 | 1 | â€¦ | 9
Solution
Left most derivation:
----------------------------
Identifier -> Identifier {Digit}
Identifier -> Identifier Identifier {Digit}
Identifier -> Identifier Identifier Identifier {Digit}
Identifier -> Identifier Identifier Identifier Identifier {Digit}
Identifier -> Identifier Identifier Identifier Identifier Identifier {Digit}
Identifier -> Identifier Identifier Identifier Identifier Identifier Identifier {Digit}
Identifier -> letter Identifier Identifier Identifier Identifier Identifier {Digit}
Identifier -> letter letter Identifier Identifier Identifier Identifier {Digit}
Identifier -> letter letter Digit Identifier Identifier Identifier {Digit}
Identifier -> letter letter Digit Digit Identifier Identifier {Digit}
Identifier -> letter letter Digit Digit letter Identifier {Digit}
Identifier -> letter letter Digit Digit letter Identifier {Digit}
Identifier -> letter letter Digit Digit letter Digit Digit
Identifier -> a b 5 6 c 7 8
----------------------------------------------------------------------------------------------------------------------------------------------------------
Right most derivation:
----------------------------
Identifier -> Identifier {Digit}
Identifier -> Identifier Identifier {Digit}
Identifier -> Identifier Identifier Identifier {Digit}
Identifier -> Identifier Identifier Identifier Identifier {Digit}
Identifier -> Identifier Identifier Identifier Identifier Identifier {Digit}
Identifier -> Identifier Identifier Identifier Identifier Identifier Identifier {Digit}
Identifier -> Identifier Identifier Identifier Identifier Identifier Digit Digit
Identifier -> Identifier Identifier Identifier Identifier letter Digit Digit
Identifier -> Identifier Identifier Identifier Digit letter Digit Digit
Identifier -> Identifier Identifier Digit Digit letter Digit Digit
Identifier -> Identifier letter Digit Digit letter Digit Digit
Identifier -> letter letter Digit Digit letter Digit Digit
Identifier -> a b 5 6 c 7 8
.

Develop leftmost and rightmost derivations respectively for the Identifier value ab56c78, using the following BNF syntax:
Identifier -> Identifier { Letter | Digit } | Letter
Letter -> a | b | â€¦ | z | A | B | â€¦ | Z
Digit -> 0 | 1 | â€¦ | 9
Solution
Left most derivation:
----------------------------
Identifier -> Identifier {Digit}
Identifier -> Identifier Identifier {Digit}
Identifier -> Identifier Identifier Identifier {Digit}
Identifier -> Identifier Identifier Identifier Identifier {Digit}
Identifier -> Identifier Identifier Identifier Identifier Identifier {Digit}
Identifier -> Identifier Identifier Identifier Identifier Identifier Identifier {Digit}
Identifier -> letter Identifier Identifier Identifier Identifier Identifier {Digit}
Identifier -> letter letter Identifier Identifier Identifier Identifier {Digit}
Identifier -> letter letter Digit Identifier Identifier Identifier {Digit}
Identifier -> letter letter Digit Digit Identifier Identifier {Digit}
Identifier -> letter letter Digit Digit letter Identifier {Digit}
Identifier -> letter letter Digit Digit letter Identifier {Digit}
Identifier -> letter letter Digit Digit letter Digit Digit
Identifier -> a b 5 6 c 7 8
----------------------------------------------------------------------------------------------------------------------------------------------------------
Right most derivation:
----------------------------
Identifier -> Identifier {Digit}
Identifier -> Identifier Identifier {Digit}
Identifier -> Identifier Identifier Identifier {Digit}
Identifier -> Identifier Identifier Identifier Identifier {Digit}
Identifier -> Identifier Identifier Identifier Identifier Identifier {Digit}
Identifier -> Identifier Identifier Identifier Identifier Identifier Identifier {Digit}
Identifier -> Identifier Identifier Identifier Identifier Identifier Digit Digit
Identifier -> Identifier Identifier Identifier Identifier letter Digit Digit
Identifier -> Identifier Identifier Identifier Digit letter Digit Digit
Identifier -> Identifier Identifier Digit Digit letter Digit Digit
Identifier -> Identifier letter Digit Digit letter Digit Digit
Identifier -> letter letter Digit Digit letter Digit Digit
Identifier -> a b 5 6 c 7 8
.