Flat (Unit-III) Notes
Flat (Unit-III) Notes
UNIT-III
SYLLABUS
1. Formal Language
4. Parse Trees
5. Ambiguous Grammars
b. Elimination of Ɛ - Productions
7. Normal Forms –
8. Pumping Lemma
9. Closure Properties
UNIT-III 1
UNIT-III
→ FORMAL LANGUAGE: -
A Formal grammar (or) Simply grammar is a precise description of a formal language.
In other words, a grammar is a notation for defining a language through a finite number of
rules.
There are two (2) main categories of formal grammar are:
Non – Terminals: - Non – Terminals symbols are those which can be replaced multiple times.
Terminals: - Terminal symbols are those symbols which cannot be replaced further.
Analytic Grammar: -
Analytic grammars are used to design a parser for the language.
Example: - 1. Top – Down Parsing language
2. Link Grammars
3. Parsing Expression Grammars
UNIT-III 2
→ CONTEXT FREE GRAMMAR: -
A Context Free Grammar can be formally defined as a set denoted by G = (V, T, P, S)
Here
V → is a set of Non-Terminals and
S → is Start Symbol.
Example: - P = {S → S +S
S→S*S
S → (S)
S → 4}
If the language is 4 + 4 * 4 then we can use the production rules given by P. The start
symbol is “S”. The number of non-terminals in the rules “P” is one and the only non-terminal
i.e., “S”. The terminals are +, *, (,), and 4.
→ DERIVATION: -
The sequence of substitutions, used to obtain a string, is called a derivation.
If “x” and “y” are sequential forms and α → β is a production, then the replacement of
“α” and “β” is x α y is called a derivation and denoted by:
UNIT-III 3
Example: -1. Consider the following grammar.
S → aSb
S→Ɛ
Derivation for String “ab”: S → aSb
➔ aƐb Here “Ɛ” (Epsilon) is a Null
➔ ab
Example: -2. Consider the following grammar.
S → Ab
A → aAb
A→Ɛ
Derivation for String “aabbb”: S → Ab
➔ aAbb
➔ aaAbbb
➔ aaƐbbb Here “Ɛ” (Epsilon) is a Null
➔ aabbb
Example: -3. Consider the following grammar.
<id> → <letter> <rest>
<rest> → <letter> <rest> | <digit> <rest> | Ɛ
<letter> → a | b | _ _ _ _ _ | z |
<digit> → 0 | 1 | _ _ _ _ _ | 9 |
Derivation for String “a0”: <id> → <letter> <rest>
➔ <letter> <digit> <rest>
➔ a <digit> <rest>
➔ a 0 <rest>
➔a 0 Ɛ Here “Ɛ” (Epsilon) is a Null
➔ a0
Forms of derivation: -
Derivation can be divided into two (2) types:
1. Left most derivation (L.M.D)
2. Right most derivation (R.M.D)
1) Left Most Derivation: -
The left most variable in the sentential form is replaced.
2) Right Most Derivation: -
The right most variable in the sentential form is replaced.
UNIT-III 4
Example: - 1. Consider the Production rules:
S → AB
A → aaA
A→Ɛ
B → Bb
B→Ɛ
Solution: -
Left Most Derivation for “aab”: Right Most Derivation for “aab”:
S → AB S → AB
➔ aaAB ➔ ABb
➔ aaƐB ➔ AƐb
➔ aaB ➔ Ab
➔ aaBb ➔ aaAb
➔ aaƐb ➔ aaƐb
➔ aab ➔ aab
Example: - 2. Consider the Production rules:
S → aAB
A → bBb
B→A|Ɛ
Solution: -
Left Most Derivation for “aab”: Right Most Derivation “aab”:
S → aAB S → aAB
➔ abBbB ➔ aAƐ
➔ abAbB ➔ aA
➔ abbBbbB ➔ abBb
➔ abbƐbbƐ ➔ abAb
➔ abbbb ➔ abbBbb
➔ abbƐbb
➔ abbbb
Example: - 3. Derive the string “1000111” for left most and right most derivation using
CFG. G = (V, T, P, S)
Here V = {S, T}, T = {0, 1}, S = {S}
P = {S → T00T
T → 0T | 1T | Ɛ}
UNIT-III 5
Example: - 4. Consider the Production rules:
E→E+E
E→E*E
E → id
The String (w) = id + id * id find L.M.D and R.M.D
Derivation tree is a graphical representation for the derivation of the given production rules for
a given CFG. It is the simple way to show how the derivation can be done to obtain some string
from a given set of production rules. The derivation tree is also called a parse tree.
Parse tree follows the precedence of operators. The deepest sub-tree traversed first. So, the
operator in the parent node has less precedence over the operator in the sub-tree.
A parse tree contains the following properties:
1. The root node is always a node indicating start symbols.
2. The derivation is read from left to right.
3. The leaf node is always terminal nodes.
4. The interior nodes are always the non-terminal nodes.
UNIT-III 6
Example: -1. How to Construct a parse tree
E→E+E
E→E*E
E→a|b|c
Input: a * b + c
Solution: -
Step 1: Step 2: Step 3: Step 4: Step 5:
Example: -2. Draw a derivation tree for the string "bbabb” from the CFG given by
S → bSb | a | b
Solution: -
Now, the derivation tree for the string "bbabb" is as follows:
UNIT-III 7
Example: - 4. Let G be a grammar with P, given by
S → aB | bA
A → a | aS | bAA
B → b | bS | aBB
Parse Tree for the string (w) = “aaabbabbba”, find the Left Most Derivation and Right Most
Derivation.
Solution: -
Left Most Derivation Can be: Parse Tree:
S → aB
➔ aaBB
➔ aaaBBB
➔ aaaBBbS
➔ aaabBbS
➔ aaabbSbS
➔ aaabbaBbS
➔ aaabbabbS
➔ aaabbabbbA
➔ aaabbabbba
Right Most Derivation Can be: Parse Tree:
S → aB
➔ aaBB
➔ aaBbS
➔ aaBbbA
➔ aaBbba
➔ aaaBBbba
➔ aaaBbbba
➔ aaabSbbba
➔ aaabbAbbba
➔ aaabbabbba
→ AMBIGUOUS GRAMMARS: -
A grammar is said to be ambiguous if there exists more than one leftmost derivation
(or) more than one rightmost derivation (or) more than one parse tree for the given input string.
If the grammar is not ambiguous, then it is called unambiguous.
UNIT-III 8
Example: - 1. Let us consider a grammar G with the production rule
E→I
E→E+E
E→E*E
E → (E)
I → ε | 0 | 1 | 2 | ... | 9
For the string "3 * 2 + 5", the above grammar can generate two parse trees by leftmost
derivation.
Solution: - Parse Trees:
Since there are two parse trees for a single string "3 * 2 + 5", the grammar G is ambiguous.
E→E+E
E→E-E
E → id
From the above grammar String "id + id - id" can be derived in 2 ways:
Solution: -
Left Most Derivation: 1. Left Most Derivation: 2.
E→E+E E→E-E
➔ id + E ➔E+E-E
➔ id + E - E ➔ id + E - E
➔ id + id - E ➔ id + id - E
➔ id + id- id ➔ id + id - id
S → aSb | SS
S→ε
For the string "aabb" the above grammar can generate two parse trees.
UNIT-III 9
Solution: - Parse Trees:
Since there are two parse trees for a single string "aabb", the grammar G is ambiguous.
Example: - 4. Check whether the given grammar G is ambiguous or not.
A → AA
A → (A)
A→a
For the string "a(a)aa" the above grammar can generate two parse trees:
Solution: -
Since there are two parse trees for a single string "a(a)aa", the grammar G is ambiguous.
→ SIMPLIFICATION OF CONTEXT FREE GRAMMAR: -
As we have seen, various languages can efficiently be represented by a context-free
grammar. All the grammar are not always optimized that means the grammar may consist of
some extra symbols(non-terminal). Having extra symbols, unnecessary increase the length of
grammar. Simplification of grammar means reduction of grammar by removing useless
symbols. The properties of reduced grammar are given below:
1. Each variable (i.e., non-terminal) and each terminal of G appears in the derivation of
some word in L.
2. There should not be any production as X → Y where X and Y are non-terminal.
3. If ε is not in the language L then there need not to be the production X → ε.
UNIT-III 10
→ Removal by Ɛ- Production: -
(or)
Elimination of Ɛ – Productions: -
The productions of type S → Ɛ are called ε productions. These types of productions can
only be removed from those grammars that do not generate Ɛ.
There are set of rules for Ɛ- Productions.
1. Find out all the null production and all the nullable variables.
Here Nullable variable: - It contains directly (or) Indirectly the Ɛ-
Productions.
2. After finding nullable variables move to R.H.S of every production and check
wherever that nullable variable is encounter, we rewrite that production with that
nullable variable (or) without it.
3. Then eliminate that nullable variables.
Example: - 1. How we will eliminate reduce Ɛ- Productions?
S → ASA | aB | b
A→B
B→b|Ɛ
Solution: -
Step: - 1. Nullable Variable are {B, A}
B → Ɛ; So this is Direct
A→B
➔ Ɛ; So this is Indirect
Step: - 2.
S → ASA | SA | AS | S | aB | a | b
A→b
B→b
So, eliminate all nullable variables.
S → ASA | SA | AS | S | aB | a | b
A→b
UNIT-III 11
B→b
Example: - 2. How we will eliminate reduce Ɛ- Productions?
S → aSb | aAb
A→Ɛ
Solution: -
Step: - 1. Nullable Variable are {A}
Step: - 2.
S → aSb | aAb | ab
So, eliminate all nullable variables.
S → aSb | aAb | ab
Example: - 3. How we will eliminate reduce Ɛ- Productions?
S → AbaC
A → BC
B→b|Ɛ
C→D|Ɛ
D→d
Solution: -
Step: - 1. Nullable Variable are {B, C, A}
B→Ɛ This is Direct nullable Variable.
C→Ɛ
A → BC This is Indirect nullable Variable.
➔ ƐC
➔ ƐƐ
➔Ɛ
Step: - 2.
S → AbaC | bac | Aba | ba
A → BC | C | B
B→b
C→D
D→d
So, eliminate all nullable variables.
S → AbaC | bac | Aba | ba
A → BC | C | B
B→b
C→D
UNIT-III 12
D→d
→ Removal by Unit Production: -
(or)
Elimination of Unit Productions: -
The unit productions are the productions in which one non-terminal gives another non-
terminal.
(or)
Any production of the form “A → B” is a Unit Production.
Example: -
S→B This is Unit Production
S→a This is Not a Unit Production
A → aXb This is Not a Unit Production
X→Y This is Unit Production
There are set of rules for Unit Productions.
Step: - 1. Write all production without unit production.
Step: - 2. Find out which string is affected after eliminate unit production one by one & “add
that string in the production.
Example: - 1. How to eliminate Unit Productions?
S → XY
X→a
Y→Z|b
Z→M
M→N
N→a
Solution: -
Step: - 1. Write all production without unit production.
S → XY
X→a
Y→b|a
Z→a
M→a
N→a
Step: - 2. after eliminate unit production one by one & “add that string in the
production.
Y→Z➔M➔N➔a
UNIT-III 13
Z→M➔N➔a
M→N→a
So, after eliminating all unit productions.
S → XY
X→a
Y→b|a
Z→a
M→a
N→a
Example: - 2. To eliminate unit productions.
S → Aa |B
B → A | bb
A → a | bc | bb
Solution: -
Step: - 1. Write all production without unit production.
S → Aa | bb | bc | a
B → bb | bc |a
A → a | bc | bb
Step: - 2. after eliminate unit production one by one & “add that string in the
production.
S → B ➔ bb
S → B ➔ A ➔a, bc
B → A ➔ a, bc
A → B ➔ bb
So, after eliminating all unit productions.
S → Aa | bb | bc | a
B → bb | bc |a
A → a | bc | bb
EXERCISE
1. Eliminate the unit production from following grammar.
S → AB
A→a
B→C|b
C→D
D → E | bC
UNIT-III 14
E → d | Ab
2. Find a CFG, without Ɛ-production, equivalent to the following grammar defined by:
(a). S → AbaC
A → BC
B→b|Ɛ
C→D|Ɛ
D→d
(b). S → ABAC
A → aA | Ɛ
B → bB | Ɛ
C →c
3. Eliminate the unit productions from the following grammar:
(a). S → A0 |B
B → A |11
A → 0 | 12 | B
(b). S → Aa | B | Ca
B → aB | b
C → Db |D
D→E|d
E → ab
→ Removal by Useless Production/Symbols: -
(or)
Elimination of Useless Productions/Symbols: -
A symbol can be useless if it does not appear on the right-hand side of the production
rule and does not take part in the derivation of any string. That symbol is known as a useless
symbol.
There are two (2) important points in useless productions.
1. Derivability → This is phase -1
2. Reachability → This is phase – 2
1) Derivability: -
Every variable should be derive something (or) some string (or) “Some
Terminal”.
There are set of rules for Derivability.
a) Find out symbols which is able to generate any string / terminal.
UNIT-III 15
b) After finding terminal just observe the production in R.H.S, which produce these
terminal & then this L.H.S (add).
c) To check R.H.S of production that is a combination of these useful symbol, then add
L.H.S.
2) Reachability: -
Variable should be reachable from “Starting Symbol”.
There are set of rules for Reachability.
a) Every symbol is reachable (or) not from the starting symbol.
UNIT-III 16
→ NORMAL FORMS: -
The productions in CFG are made to satisfy certain restriction, then CFG is said to be
in normal form.
There are two (2) types of Normal Forms.
1. Chomsky Normal Form (CNF)
2. Greibach Normal Form (GNF)
1) Chomsky Normal Form (CNF): -
Chomsky Normal Form (CNF) puts restrictions on number of symbols on the
right of a production.
In other words, the string, on the right of a production, Consists of “not more
than two symbols”.
Non – Terminal → Non – Terminal Non – Terminal
(or)
UNIT-III 17
Example: - 1. A → BC It is a CNF
2. A → a It is a CNF
Example: - 3. The grammar
S → BS | a
B → SB | b
This is in CNF
Example: - 4. The grammar
S → BS | BSB
B → SB | aa
Solution: - S → BS, B → SB is a CNF, but S → BSB & B → aa is not a CNF
Example: - 5. The grammar
S → AB | CA
B → BC | AB
A→a
C → aB | b
Solution: - C → aB is not in CNF.
→ Reduction of CFG to CNF: -
(or)
Conversion of CFG to CNF: -
Let G1 = (V, T, P, S) be the CFG generating a language not containing Ɛ.
We construct G2 = (V11, T, P11, S) as follows:
Step: - 1. To Eliminate “Ɛ – Production” and “Unit production”.
Step: - 2. Eliminate terminals on R.H.S
Step: - 3. Restrict the number of variables on R.H.S
Example: - 1. Reduce the grammar into CNF.
S → aAD
A → aB | bAB
B→b
D→d
Solution: -
Step: - 1. To Eliminate Ɛ – Production & Unit production.
There are “no” Such productions.
Step: - 2. Eliminate terminals on R.H.S
P1 = {B → b, D → d} is in CNF.
To Reduce the number of terminals in
UNIT-III 18
S → aAD
A → aB | bAB
Thus
S → aAD where Ta → a
➔ TaAD
A → aB
➔TaB It is CNF
A → bAB where Tb → b
➔ TbAB
S → TaAD
A → TaB
A → TbAB
Step: - 3. Restrict number of variables on the R.H.S
S → TaAD where K1 → AD
➔ Ta K1
A → TbAB where K2 → AB
➔ Tb K2
P11 = {S → Ta K1
A → TaB
A → Tb K2
B→b
D → d}
V11 = {S, A, B, D, Ta, Tb, K1, K2}
T = {b, d}
S = {S}
So, this is Chomsky Normal Form (CNF)
Example: - 2. For the grammar given below. Find an equivalent grammar in CNF.
S → bA | aB
A → bAA | aS | a
B → aBB | bS | b
Solution: -
Step: - 1. To Eliminate Ɛ – Production & Unit production.
There are “no” Such productions.
Step: - 2. Eliminate terminals on R.H.S
UNIT-III 19
P1 = {A → a, B → b} is in CNF.
To Reduce the number of terminals in
S → bA | aB
A → bAA | aS
B → aBB | bS
Thus
S → bA where Tb → b
➔TbA It is CNF
S → aB where Ta → a
➔ TaB It is CNF
A → bAA
➔TbAA
A → aS
➔TaS It is CNF
B → aBB
➔TaBB
B → bS
➔TbS It is CNF
S → TbA | TaB
A → TbAA | TaS
B → TaBB | TbS
Step: - 3. Restrict number of variables on the R.H.S
A → TbAA where P1 → AA
➔ T b P1 It is CNF
B → TaBB where P2 → BB
➔TaP2 It is CNF
P11 = {S → TbA | TaB
A → TbP1 | TbP1 | a
B → TaP2 | TbS | b}
V11 = {S, A, B, Ta, Tb, P1, P2}
T = {a, b}
S = {S}
So, this is Chomsky Normal Form (CNF).
UNIT-III 20
Example: - 3. Convert the following CFG to CNF.
S → ABA
A → aA | Ɛ
B → bB | Ɛ
Solution: -
Step: - 1. To Eliminate Ɛ – Production &
A → Ɛ, B → Ɛ eliminated
“no” Unit Productions.
S → ABA | BA | AB | B | AA | A
A → aA | a
B → bB | b
To Eliminate Unit production.
S → ABA | BA | AB | AA | bB | b | aA | a
A → aA | a
B → bB | b
Step: - 2. Eliminate terminals on R.H.S
P1 = {A → a, B → b} is in CNF.
To Reduce the number of terminals in
S → ABA where R1 → BA
➔ AR1 It is CNF
S → BA It is CNF
S → AB It is CNF
S →AA It is CNF
S → bB where Tb → b
➔TbB It is CNF
S → aA where Ta → a
➔TaA It is CNF
S→b It is CNF
S→a It is CNF
A → aA where Ta → a
➔TaA It is CNF
A →a It is CNF
B → bB where Tb → b
➔TbB It is CNF
B→b It is CNF
UNIT-III 21
Step: - 3. Restrict number of variables on the R.H.S
P11 = {S → AR1 | BA | AB | AA | TbB | TaA | b | a
A → TaA | a
B → TbB | b}
V11 = {S, A, B, Ta, Tb, R1}
T = {a, b}
S = {S}
So, this is Chomsky Normal Form (CNF).
EXERCISE
1) Construct equivalent grammar in CNF for the grammar G = ({S, A, B}, {a, b}, {S →
aAbB, A → aA | a, B → bB | b}, S).
2) Reduce the grammar into CNF.
S → aAa
A → bBB | D
B → ab | Ɛ
C → aB
3) Convert the following grammar into CNF.
S → AbcD | abc
A → aASB | d
B → b | cb
D→d
4) Reduce the grammar, into CNF.
S → A0B
A → AA | 0S | 0
B → 0BB | 1S | 1
2. Greibach Normal Form (GNF): -
A CFG is in GNF if all production rules must satisfy one of the following conditions:
1. A non-terminal generating a terminal value.
Example: - A → b
2. A non-terminal generating a terminal followed by number of non-terminals.
Example: - S → aABC
3. Starting symbol generating “Ɛ” symbol.
Example: - S → Ɛ
Example: - 1. The grammar is GNF (or) not.
S → aSB | aB
UNIT-III 22
B→b
Solution: - It is GNF.
Example: - 2. The grammar is GNF (or) not.
S → AB
A → aA | bB | b
B→b
Solution: - S → AB is not a GNF
A → aA | bB | b It is GNF
B→b It is GNF
→ To Reduce CFG to GNF: -
(or)
To Converting CFG to GNF: -
There are multiple steps.
Step: - 1. Start with a grammar G = (V, T, P, S)
Step: - 2. Remove all the null Productions (Ɛ).
Step: - 3. Remove Unit Productions.
Step: - 4. Remove all direct and Indirect left Recursion.
Step: - 5. Do proper substitution of productions to convert it into proper form of GNF.
Left Recursion: -
Left most symbol of R.H.S of production is equal to the L.H.S is called “Left
Recursion”.
A → Aα | β
We have to Convert
A → β A1
A1 → Ɛ | α A1
Example: - E→E+T|T
A A α β
We have to Convert
E → TE1
E1 → Ɛ | +T E1
UNIT-III 23
Right Recursion: -
Right most symbol of R.H.S of production is equal to the L.H.S is called “Right
Recursion”.
Example: - 1. To Reduce CFG to GNF
S → XA | BB
B → b |SB
X→b
A→a
Solution: -
Step: - 1. The Grammar G = (V, T, P, S)
V = {S, B, X, A}, T = {a, b}, S = {S}
Step: - 2. There is “no” null productions.
Step: - 3. There is “no” unit productions.
Step: - 4. There is “no” left Recursion in the grammar.
Step: - 5. Do proper substitution of Productions
S → XA | BB There are not in the GNF
B → SB
B→b
X→b There is a GNF
A→a
We have to eliminate all the non – GNF Property.
1. We substitute/ Replace S → XA | BB in B → SB
S → XA | BB
B → b | XAB | BBB
X→b
A→a
2. We substitute/ Replace X →b in S → XA (or) B → XAB
S → XA
➔bA | BB
B → bAB | b | BBB
X→b
A→a
UNIT-III 24
The left Recursion is
B → B BB | b | bAB
A A α β1 β2
We have to Convert
B → bC | bABC
C → Ɛ | BBC
UNIT-III 25
Whether the grammar is GNF (or) not. To check it only one grammar is not a GNF.
S → BB
We have Substitute / Replace “B” in “S”.
S → bA | bCB | bB | bABCB | bABB
B → bC | b | bABC | bAB
C → bCBC | bBC | bABCBC | bABBC
C → bCB | bB | bABCB | bABB
X→b
A→a
So, the above grammar is GNF.
Example: - 2. Convert the following CFG into GNF
S → AA | 0
A → SS | 1
UNIT-III 26
UNIT-III 27
UNIT-III 28
EXERCISE
UNIT-III 29
• For any language L, we break its strings into five (5) parts and pump “second and
fourth substring”.
L →U V W X Y
• Pumping Lemma, here also, is used as a tool to prove that a language is not CFL.
Because, if any one string does not satisfy its conditions, then the language is not
CFL.
Theorem: -
Thus, if “L” is a CFL, there exists an integer “C”, such that for all x Ɛ L with |x| ≥ C,
there exists u, v, w, x, y Ɛ Σ∗, such that x = uvwxy, and following conditions satisfied:
(1) for all i ≥ 0: uviwxiy Ɛ L
(2) |vwx| ≤ n
(3) |vx| ≥ 1
UNIT-III 30
→ CLOSURE PROPERTIES OF CONTEXT FREE LANGUAGE: -
The context free languages are closed under some operations means after performing
that particular operation on those CFL’s the resultant language is context free language.
The properties are as below:
1. The context free languages are closed under Union.
2. The context free languages are closed under Concatenation.
3. The context free languages are closed under Kleen Closure.
4. The context free languages are not closed under Intersection.
5. The context free languages are not closed under Intersection with Regular
Language.
6. The context free languages are not closed under Complement.
1) Union: -
Let L1 and L2 be two context free languages. Then L1 ∪ L2 is also context free.
Example: -
Let L1 = {an bn, n > 0}. Corresponding grammar G1 will have P: S1 → aAb | ab
2) Concatenation: -
If L1 and L2 are context free languages, then L1L2 is also context free.
Example: -
Concatenation of the languages L1 and L2, L = L1L2 = {anbncmdm}
3) Kleene Closure: -
If L is a context free language, then L* is also context free.
Example: -
Let L = {anbn, n ≥ 0}. Corresponding grammar G will have P: S → aAb | ab
UNIT-III 31
• Intersection − If L1 and L2 are context free languages, then L1 ∩ L2 is not necessarily
context free.
• Complement − If L1 is a context free language, then L11 may not be context free.
Read out the leaf nodes and you will get id = id + id ; If ; is missing in your statement rule
won’t get matched with T branch and hence it will generate syntax error as ‘Statement ;
missing’.
Thus, Context Free grammar is a powerful tool used in compilers for syntax analysis.
UNIT-III 32
→ Difference between Pumping Lemma for Regular Language and Context Free
Language: -
S. No Pumping Lemma for Regular Language Pumping Lemma for Context Free Language
Derive Some String from the given Derive Some String from the given language.
1.
language.
Divide the Derived String into three (3) Divide the Derived String into five (5) parts
2.
parts Such as W = U V W. Such as W = U V W X Y
Now w = u vk w is also in the language for Now w= u vi w xi y is also in the language for
3.
k ≥ 1. i ≥ 1.
Now Check w = u vk w derived string is in Now check w= u vi w xi y derived string is in the
4.
the language (or) not. language (or) not.
Example: - Prove that L = {ai bi | i ≥ 0} is Example: - Prove that L = {0n 1n 2n | n ≥ 0} is
5.
not a regular not a context free.
UNIT-III 33