automata-6 - Automata Chapter 6 Simplification of...

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

View Full Document Right Arrow Icon
Automata Chapter 6. Simplification of Context- Free Grammars and Normal Forms
Background image of page 1

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

View Full DocumentRight Arrow Icon
Chapter 6 Simplification of Context- Free Grammars and Normal Forms Simplify context-grammars: Remove useless variables and productions Remove λ -productions Remove unit-productions Normal forms: Chomsky normal form, Greibach normal form. No loss of generality: Transformed G=(V,T,S,P) for L-{ λ } add a variable S 0 and make S 0 the start variable and add S 0 S | λ to the P.
Background image of page 2
6.1 Methods for Transforming Grammars A useful substitution rule: Theorem 6.1 Let G = (V,T,S,P) be a context-free. Suppose P has A x 1 Bx 2 where A B and B y 1 |y 2 |…|y n . Let G^=(V,T,S,P^) be the grammar where P^= P–(A x 1 Bx 2 )+( A x 1 y 1 x 2 | x 1 y 2 x 2 |…|x 1 y n x 2 ). Then L(G^)=L(G).
Background image of page 3

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

View Full DocumentRight Arrow Icon
6.1 Methods for Transforming Grammars Ex 6.1 G=({A,B}, {a,b,c}, A, P) with P: A a|aaA|abBc, B abbA|b. G^? aaabbc? Removing Useless Productions Remove productions from a grammar that can never take part in any derivation Ex. S aSb | λ | A, A aA
Background image of page 4
6.1 Methods for Transforming Grammars Definition 6.1 Let G be a context-free. A variable A V is useful iff 5 at least one w L(G) s.t. S xAy w , with x, y in (V T)*. A useful variable occurs in at least one derivation. A variable that is no useful is called useless. A production is useless if it involves any useless variable. Ex 6.2 S A, A aA| λ , B bA. Any useless? Useless: non-reachable from S or no string-derivable * *
Background image of page 5

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

View Full DocumentRight Arrow Icon
Grammars Ex 6.3 Eliminate useless: S aS|A|C, A a, B aa, C aCb. Dependency graph: vertices of variables with an edge
Background image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 11/03/2009 for the course CS automata taught by Professor Prof.jung during the Fall '09 term at 홍익대학교.

Page1 / 24

automata-6 - Automata Chapter 6 Simplification of...

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

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