Here we create a context-free grammar for the language 0*1*; the purpose of this example is to show why more than one variable is sometimes needed. I realized after I recorded this video that in this case, we could modify the second rule to be S goes to S1, which will guarantee to make the 1s at the end, and does not interfere with the first rule. So another CFG for this would be S goes to 0S | S1 | epsilon. (What I made in the video is called a *regular grammar*, but since we only need to make a context-free grammar, we are not limited by any restriction of where terminals/variables/etc. are.)
Easy Theory Website: www.easytheory.org
Discord: / discord
If you like this content, please consider subscribing to my channel: / @easytheory
▶ABOUT ME◀
I am a professor of Computer Science, and am passionate about it. I have taught many courses at several different universities, including several sections of undergraduate and graduate theory-level classes.
The views expressed in this video are not reflective of any of my current or former employers.
Негізгі бет Context-Free Grammar (CFG) Example: 0*1*
Пікірлер: 4