automata-6

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

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

Automata Chapter 6. Simplification of Context- Free Grammars and Normal Forms

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

View Full Document
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.
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).

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

View Full Document
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
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 * *

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

View Full Document
Grammars Ex 6.3 Eliminate useless: S aS|A|C, A a, B aa, C aCb. Dependency graph: vertices of variables with an edge
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
Ask a homework question - tutors are online