Context_Free_Grammars_Normal

# Context_Free_Grammars_Normal - Simplifications of...

This preview shows pages 1–12. Sign up to view the full content.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Simplifications of Context-Free Grammars 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 → 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 → In general: 1 y B xBz A → → Substitute z xy xBz A 1 | → equivalent grammar 1 y B → Nullable Variables : production- λ λ → X Nullable Variable: λ ⇒ ⇒ Y Example: λ → → → M aMb M aMb S Nullable variable production- λ λ → 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- λ 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 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: 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 Substitute A B → bb B a A aA aB aA S → → → | | bb B A B a A aB aA S → → → → | Remove repeated productions bb B a A aB aA S → → → | bb B a A aA aB aA S → → → | | Final grammar Useless Productions...
View Full Document

{[ snackBarMessage ]}

### Page1 / 38

Context_Free_Grammars_Normal - Simplifications of...

This preview shows document pages 1 - 12. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online