Recursive Grammer

Sep 7, 2016 at 11:33pm
.
Last edited on Sep 14, 2016 at 7:07pm
Sep 7, 2016 at 11:49pm
Write the procedure on paper, convert that to a english sentence to describe what your trying to do.
Sep 8, 2016 at 12:18am
.
Last edited on Sep 14, 2016 at 7:07pm
Sep 8, 2016 at 12:32am
Follow your pseudo-code and see if it does indeed produce the desired result.

It's not too difficult to turn pseudo-code into actual code and run it. Try that and see if it gives you the result you want.
For part b, you don't even need code for that. You can check it by hand, but the code you produce should also tell give you the same answer.

Dinomite07 wrote:
{X,Y}, {Z,Y}, {X,Z}, {Z,X}

The definition says
A string in this language must begin with an X
. Do all of those strings begin with an X? Your instructor may want a certain format, but that looks like you're listing subsets. You might want to write it like {XY, ZY, XZ, ZX}. But, of course, be sure to check to make sure all of those strings are actually in the language. Does it say anything about a string beginning with an X and also ending with an X?
Sep 8, 2016 at 12:41am
I made and follow the code so I think it's right but I am not sure. I know how to use Java but not C++.

Sep 8, 2016 at 12:49am
How would you write it in Java? Translating Java to C++ isn't that hard - they are syntactically similar up to a point, and certainly similar enough for the methods you'd use for this problem.

Many of us here can also understand Java. Go ahead and show us what you'd write in Java and we can help you go from there.
Sep 8, 2016 at 1:14am
Are there any guides/tutroials for recursive grammar I can study? I can't seem to find any.
Topic archived. No new replies allowed.