Context_Free_Grammars

Context_Free_Grammars - Context-Free Languages Regular...

Info iconThis preview shows pages 1–18. Sign up to view the full content.

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Context-Free Languages Regular Languages } : { ≥ n b a n n } { R ww * * b a * ) ( b a + Context-Free Languages Context-Free Languages Pushdown Automata Context-Free Grammars stack automaton Context-Free Grammars Grammars Grammars express languages Example: the English language grammar verb predicate noun article phrase noun predicate phrase noun sentence → → → _ _ sleeps verb runs verb dog noun cat noun the article a article → → → → → → Derivation of string “the dog walks”: sleeps dog the verb dog the verb noun the verb noun article verb phrase noun predicate phrase noun sentence ⇒ ⇒ ⇒ ⇒ ⇒ ⇒ _ _ Derivation of string “a cat runs”: runs cat a verb cat a verb noun a verb noun article verb phrase noun predicate phrase noun sentence ⇒ ⇒ ⇒ ⇒ ⇒ ⇒ _ _ Language of the grammar: L = { “a cat runs”, “a cat sleeps”, “the cat runs”, “the cat sleeps”, “a dog runs”, “a dog sleeps”, “the dog runs”, “the dog sleeps” } cat noun → Variables Sequence of Terminals (symbols) Productions predicate phrase noun sentence _ → Sequence of Variables Another Example λ → → S aSb S Grammar: Variable Sequence of terminals and variables The right side may be λ Grammar: Derivation of string : λ → → S aSb S ab aSb S ⇒ ⇒ ab aSb S → λ → S Grammar: Derivation of string : aabb aaSbb aSb S ⇒ ⇒ ⇒ aSb S → λ → S aabb λ → → S aSb S aaabbb aaaSbbb aaSbb aSb S ⇒ ⇒ ⇒ ⇒ aaaabbbb aaaaSbbbb aaaSbbb aaSbb aSb S ⇒ ⇒ ⇒ ⇒ ⇒ Other derivations: λ → → S aSb S Grammar: λ → → S aSb S } : { ≥ = n b a L n n Grammar: Language of the grammar: We write: Instead of: aaabbb S * ⇒ aaabbb aaaSbbb aaSbb aSb S ⇒ ⇒ ⇒ ⇒ for zero or more derivation steps A Convenient Notation n w w * 1 ⇒ n w w w w...
View Full Document

This note was uploaded on 12/02/2011 for the course AR 107 taught by Professor Gracegraham during the Fall '11 term at Montgomery College.

Page1 / 59

Context_Free_Grammars - Context-Free Languages Regular...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online