





























Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
How to simplify context-free grammars by applying substitution rules, removing useless productions, and eliminating ε-productions and unit-productions. It also introduces chomsky normal form and greibach normal form, which are important normal forms for context-free grammars.
Typology: Study notes
1 / 37
This page cannot be seen from the preview
Don't miss anything!






























A x 1 Bx 2 P B y 1 | y 2 | ... | yn P L(G) = L(G^) G^ = (V, T, S, P^) A x 1 y 1 x 2 | x 1 y 2 x 2 | ... | x 1 ynx 2 P^
A Ax 1 | Ax 2 | ... | Axn P A y 1 | y 2 | ... | ym P L(G) = L(G^) G^ = (V{Z}, T, S, P^) A yi | yiZ (i =1, m) P^ Z xi | xiZ (i =1, n) P^
G = ({A, B}, {a, b}, A, P) A Aa | aBc | B Bb | ba A aBc | aBcZ | Z | A aBc | aBcZ | Z | Z a | aZ Z a | aZ B Bb | ba B ba | baY Y b | bY
A V is useful iff there is w L(G) such that: S * xAy * w A production is useless it it involves any useless variable.
G = ({S, A, B}, {a, b}, S, P) S A A aA | B bA
G = ({S, A, B, C}, {a, b}, S, P) S aS | A | C S aS | A S aS | A A a A a A a B aa B aa C aCb dependency graph S A B
Let G = (V, T, S, P) be a context-free grammar. Then there exists an equivalent grammar G^ = (V^, T^, S, P^) that does not contain any useless variables or productions.
Proof:
Proof:
S aS 1 b S aS 1 b | ab S 1 aS 1 b | S 1 aS 1 b | ab
Let G = (V, T, S, P) be a CFG such that L(G). Then there exists an equivalent grammar G^ having no -productions.
Proof:
S ABaC S ABaC | BaC | AaC | ABa | aC | Aa |Ba | a A BC A B | C | BC B b | B b C D | C D D d D d VN = {A, B, C}