Lec05A

Lec05A - Vc-> a girl with a...

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

View Full Document Right Arrow Icon
Section 2.1 Context Free Grammars - Vladimir Reilly A-> 0A1 A->B B-># {A,B} variables, {0,1,#} terminals A->0A1->00A11->000A111->000b111->000#111 We end up with a string of terminals. All strings derivable by the grammar are in the language. All strings not derivable are not in the language. A /\ 0A1 /\ 0A1 /\ 0A1 | B | # Context free grammar can be used to describe English grammar. S->NpVp Np->Nc|NcPp Vp->Vc|VcPp Pp->PNc Nc->AN Vc->V|VNp A->a|the N->boy girl| flower V->touches|likes|sees p->with String “a girl with a flower likes the boy” is derived in the following manner S->NpVp->NcPpVp->ANPpVp->a girlPNcVp->a girl with ANVp->a girl with a flower
Background image of page 1

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

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

Unformatted text preview: Vc-> a girl with a flowerVNp->a girl with a flower likes Nc-> a girl with a flower likes the boy The formal description of the context free grammar. CFG = (V, ,R,S) V = variables = terminals R = rules S = start symbol Context free grammar to describe a non-regular language L={0 n 1 n }U{1 n n } S 1->0S 1 1| S 2-> 1S 2 0| S-> S 1 | S 2 DFA=>CFG 1 1 1 1 q =S q 1 =A q 2 =B q 3 =C S->0A | 1S A-> 0C|1B| B->1C|0A C->0S|1B| String 011010 Derivation S->0A->01B->011C->0110S->01101S->011010A->011010 Q Q 1 Q 3 Q 2...
View Full Document

Page1 / 2

Lec05A - Vc-> a girl with a...

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

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