Discussion:
Review Notes Questions
(too old to reply)
BE Tweddle
2004-08-02 00:37:43 UTC
Permalink
Hi,

Having taken a look at the review notes - I've got a few questions:

Question 4:

The proposed solution is:
(10)*(0|010)|(10)*(1|101)

Is this capable of recognizing the string "10" or "01" which fit the
problem criteria?

Do you not need the solution to be:
(10)*(0|010)|(10)*(1|101)|(01)|(10)

In a related question, the precedence for regular expression operators
are:

()
*
.
|

correct??



Question 11:

If I'm not mistaken the proposed solution recognizes the string "cb" which
the given grammar does not. Does this solution work better, or am I wrong:

<A>->a<B>b
<A>->cab
<B>->a
<B>->epsilon


Please let me know if I'm way off on any of these.


Thanks,
Brent
Nguyen Nguyen
2004-08-02 03:54:53 UTC
Permalink
Thanks for pointing out these errors. Sorry about that.

Question 4:
I think you mean (01)*(0|010)|(10)*(1|101)|01|10. This is correct. There
are other valid solutions too.

Precedence of RE operators (highest to lowest):
()
*
concatenation
alternation

Question 11:
Yes, you're right. The proposed grammar accepts cb, which it should not.


Nguyen
Post by BE Tweddle
Hi,
(10)*(0|010)|(10)*(1|101)
Is this capable of recognizing the string "10" or "01" which fit the
problem criteria?
(10)*(0|010)|(10)*(1|101)|(01)|(10)
In a related question, the precedence for regular expression operators
()
*
.
|
correct??
If I'm not mistaken the proposed solution recognizes the string "cb" which
<A>->a<B>b
<A>->cab
<B>->a
<B>->epsilon
Please let me know if I'm way off on any of these.
Thanks,
Brent
Nguyen Nguyen
2004-08-03 15:48:18 UTC
Permalink
As some people pointed out today at the review session, there is also a
problem with the solution for Question 9. <closure> cannot go to
<term><closure>.

Sorry.

Nguyen
Post by BE Tweddle
Hi,
(10)*(0|010)|(10)*(1|101)
Is this capable of recognizing the string "10" or "01" which fit the
problem criteria?
(10)*(0|010)|(10)*(1|101)|(01)|(10)
In a related question, the precedence for regular expression operators
()
*
.
|
correct??
If I'm not mistaken the proposed solution recognizes the string "cb" which
<A>->a<B>b
<A>->cab
<B>->a
<B>->epsilon
Please let me know if I'm way off on any of these.
Thanks,
Brent
Continue reading on narkive:
Loading...