in Theory of Computation
823 views
1 vote
1 vote

We know Regular Union CFL is CFL as they are closed but a doubt came in my mind 

if

Regular -  (a+b)*

CFL -   anb

Isn't it regular (a+b)* U anbn   (a+b)* 

Then how come this statement Regular Union CFL is CFL as they are closed is true ?? 

Please correct me if i am wrong..

in Theory of Computation
823 views

2 Comments

Every regular is CFL because CFL can be parsed by PDA by using FA and stack. Hence for (a+b)* i will use of FA part of PDA and not stack.So it means PDA can parse (a+b)*,hence this is CFL.Every regular is CFL but converse not true.
2
2
Hello Rahul , your answer is quite correct , when you are sure enough about the correctness of your answer please try to make it in form of answer rather comment so at least it doesn't appear in unanswered questions. It may save our time.
1
1

1 Answer

3 votes
3 votes
Best answer
Every regular is CFL because CFL can be parsed by PDA by using FA and stack. Hence for (a+b)* i will use of FA part of PDA and not stack.So it means PDA can parse (a+b)*,hence this is CFL.

Note:-Every regular is CFL but converse not true.
selected by

3 Comments

I understood your explaination but can you give  any example by taking cfl and regular languages please
0
0
Thanks bro @rahul sharma 5
0
0
@student2018  my question is itself an example
1
1

Related questions