I must have dozed off in class. I have an exam tommorow and this is on the review sheet and i have no idea what this means. If someone could explain it and/or have a link for somewhere I can learn about "it" that would be helpful. thanks
Consider the language that the following grammar defines:
< S > ::= $ | < W > | $< S >
< W > ::= abb | a < W > bb
Write all strings that are in this language and contain seven or fewer character
Edit: Heres another example:
< Str >::= X< Str > | Y< Another > < Another >::= Z | Z< Another >
Write some string in this language that contains more than three characters.
Looks like you slept through the class on Backus–Naur Form.
The first example has two rules.
The first:
Says that
<S>
is either a dollar symbol, a<W>
or a dollar followed by a<S>
The second:
Says that
<W>
can beabb
or can bea
followed by a<W>
followed bybb
Notice that in this example, an
<S>
can contain another<S>
and a<W>
can contain another<W>
So the list of all the strings that are less than 8 characters would start:
And that's before we have even considered using the rule for
<W>
.Lets hope the questions in your exam are more like the second example. The answer for which could be as simple as
XYZZ