computation-theory

Can someone give a simple but non-toy example of a context-sensitive grammar? [closed]

这一生的挚爱 提交于 2019-11-29 10:34:36
问题 I'm trying to understand context-sensitive grammars, and I understand why languages like {ww | w is a string} {a n b n c n | a,b,c are symbols} are not context free, but what I'd like to know if a language similar to the untyped lambda calculus is context sensitive. I'd like to see an example of a simple, but non-toy (I consider the above toy examples), example of a context-sensitive grammar that can, for some production rule, e.g., tell whether or not some string of symbols is in scope

What will be the DFA for the regular expression 0(0+1)*0+1(0+1)*1?

孤人 提交于 2019-11-27 16:22:39
This is the DFA i have drawn- Is it correct? I am confused because q4 state has 2 different transitions for same input symbol which violates the rule of DFA , but I can't think of any other solution. Your DFA is not correct. your DFA is completely wrong so I don't comment DFA for RE: 0(1 + 0)*0 + 1(1 + 0)*1 Language Description : if string start with 0 it should end with 0 or if string start with 1 it should end with 1 . hence two final states (state-5, state-4). state-4 : accepts 1(1 + 0)*1 state-5 : accepts 0(1 + 0)*0 state-1 : start state. DFA : EDIT : + Operator in Regular Expression (0 +

Pumping lemma for regular language

☆樱花仙子☆ 提交于 2019-11-27 09:18:45
I have a little confusion in checking whether the given language is regular or not using pumping lemma. Suppose we have to check whether: L. The language accepting even number of 0 's in regular or not? We know that it is regular because we can construct a DFA for L. But I want to prove this with pumping lemma. Now suppose, I take a String w= "0000" : Now will divide the string as x = 0 , y = 0 , and z = 00 . Now on applying pumping lemma for i = 2 , I will get the string "00000" , which is not present in my language so by pumping lemma its prove that the language is not regular. But it is

Need Regular Expression for Finite Automata: Even number of 1s and Even number of 0s

别来无恙 提交于 2019-11-27 01:05:13
My problem may sounds different to you. I am a beginner and I am learning Finite Automata. I am googing over Internet to find the Regular Expression for Finite Automata of Given Machine Below. Can anyone help me to write "Regular Expression for Finite Automata" of above machine Any help will be appreciated Grijesh Chauhan How to write regular expression for a DFA using Arden theorem Lets instead of language symbols 0 , 1 we take Σ = {a, b} and following is new DFA. Notice start state is Q 0 You have not given but In my answer initial state is Q 0 , Where final state is also Q 0 . Language

Is a*b* regular?

对着背影说爱祢 提交于 2019-11-26 20:58:32
I know a n b n for n > 0 is not regular by the pumping lemma but I would imagine a*b* to be regular since both a,b don't have to be the same length. Is there a proof for it being regular or not? Grijesh Chauhan Answer to your question: imagine a*b* to be regular, Is there a proof for it being regular or not? No need to imagine, expression a*b* is called r egular e xpression (re), and regular expressions are possible only for regular languages. If a language is not a regular then regular expression is also not possible for that and if a language is regular language then we can always represent

What will be the DFA for the regular expression 0(0+1)*0+1(0+1)*1?

♀尐吖头ヾ 提交于 2019-11-26 18:36:37
问题 This is the DFA i have drawn- Is it correct? I am confused because q4 state has 2 different transitions for same input symbol which violates the rule of DFA , but I can't think of any other solution. 回答1: Your DFA is not correct. your DFA is completely wrong so I don't comment DFA for RE: 0(1 + 0)*0 + 1(1 + 0)*1 Language Description : if string start with 0 it should end with 0 or if string start with 1 it should end with 1 . hence two final states (state-5, state-4). state-4 : accepts 1(1 +

Pumping lemma for regular language

倖福魔咒の 提交于 2019-11-26 17:49:44
问题 I have a little confusion in checking whether the given language is regular or not using pumping lemma. Suppose we have to check whether: L. The language accepting even number of 0 's in regular or not? We know that it is regular because we can construct a DFA for L. But I want to prove this with pumping lemma. Now suppose, I take a String w= "0000" : Now will divide the string as x = 0 , y = 0 , and z = 00 . Now on applying pumping lemma for i = 2 , I will get the string "00000" , which is

Left-Linear and Right-Linear Grammars

南楼画角 提交于 2019-11-26 14:14:35
I need help with constructing a left-linear and right-linear grammar for the languages below? a) (0+1)*00(0+1)* b) 0*(1(0+1))* c) (((01+10)*11)*00)* For a) I have the following: Left-linear S --> B00 | S11 B --> B0|B1|011 Right-linear S --> 00B | 11S B --> 0B|1B|0|1 Is this correct? I need help with b & c. Constructing an equivalent Regular Grammar from a Regular Expression First, I start with some simple rules to construct Regular Grammar(RG) from Regular Expression(RE). I am writing rules for Right Linear Grammar (leaving as an exercise to write similar rules for Left Linear Grammar) NOTE:

Need Regular Expression for Finite Automata: Even number of 1s and Even number of 0s

点点圈 提交于 2019-11-26 09:34:19
问题 My problem may sounds different to you. I am a beginner and I am learning Finite Automata. I am googing over Internet to find the Regular Expression for Finite Automata of Given Machine Below. Can anyone help me to write \"Regular Expression for Finite Automata\" of above machine Any help will be appreciated 回答1: How to write regular expression for a DFA using Arden theorem Lets instead of language symbols 0 , 1 we take Σ = {a, b} and following is new DFA. Notice start state is Q 0 You have

Left-Linear and Right-Linear Grammars

天涯浪子 提交于 2019-11-26 03:49:27
问题 I need help with constructing a left-linear and right-linear grammar for the languages below? a) (0+1)*00(0+1)* b) 0*(1(0+1))* c) (((01+10)*11)*00)* For a) I have the following: Left-linear S --> B00 | S11 B --> B0|B1|011 Right-linear S --> 00B | 11S B --> 0B|1B|0|1 Is this correct? I need help with b & c. 回答1: Constructing an equivalent Regular Grammar from a Regular Expression First, I start with some simple rules to construct Regular Grammar(RG) from Regular Expression(RE). I am writing