10e_Context_Free_Grammars_Normal.pdf - Simplifications of Context-Free Grammars A Substitution Rule Equivalent grammar S aB A aaA A abBc B aA Bb S aB |

10e_Context_Free_Grammars_Normal.pdf - Simplifications of...

This preview shows page 1 - 12 out of 38 pages.

Simplifications of Context-Free Grammars
Image of page 1

Subscribe to view the full document.

A Substitution Rule b B aA B abBc A aaA A aB S Substitute Equivalent grammar aA B abbc abBc A aaA A ab aB S | | b B
Image of page 2
Equivalent grammar abaAc abbc abBc A aaA A aaA ab aB S | | | | aA B abbc abBc A aaA A ab aB S | | Substitute aA B
Image of page 3

Subscribe to view the full document.

In general: 1 y B xBz A Substitute z xy xBz A 1 | equivalent grammar 1 y B
Image of page 4
Nullable Variables : production X Nullable Variable: Y Example: M aMb M aMb S Nullable variable production
Image of page 5

Subscribe to view the full document.

M M aMb M aMb S Substitute ab aMb M ab aMb S | | Removing s production After we remove all the all the nullable variables disappear (except for the start variable) s production
Image of page 6
Unit-Productions Y X Unit Production: (a single variable in both sides) bb B A B B A a A aA S Example: Unit Productions
Image of page 7

Subscribe to view the full document.

bb B A B B A a A aA S Substitute B A bb B B A B a A aB aA S | | Removal of unit productions:
Image of page 8
Remove bb B B A B a A aB aA S | | bb B A B a A aB aA S | B B X X can be removed immediately Unit productions of form
Image of page 9

Subscribe to view the full document.

Substitute A B bb B a A aA aB aA S | | bb B A B a A aB aA S |
Image of page 10
Remove repeated productions bb B a A aB aA S | bb B a A aA aB aA S | | Final grammar
Image of page 11

Subscribe to view the full document.

Image of page 12
  • Fall '19
  • Abyaym

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Ask Expert Tutors You can ask You can ask ( soon) You can ask (will expire )
Answers in as fast as 15 minutes