Im in a functional languages computer science class and I have a question on the use of the kleene star and the Union in a context free grammar.
for the kleene star I have an idea of how I might do it. for example
{0^n 1^n | n in the set of natural numbers}
I think it would look something like this.
S-> 0S1 | A
A-> S | lambda
where lambda would mark closing or ending the string. Is this right?
as for how the union would I dont understand at all how it would work. wer were given an example that looks like this
{0^n1^n | n in the set of natural nubmer} U
{0^n1^2n | n in the set of natural numbers}
I know how I would make a context free grammar for either of these alone but I dont know how the union comes into play with this.