Welcome! Log In Create A New Profile

Advanced

Second Semester Assignment 1

Posted by dve83 
Announcements Last Post
Announcement SoC Curricula 09/30/2017 01:08PM
Announcement Demarcation or scoping of examinations and assessment 02/13/2017 07:59AM
Announcement School of Computing Short Learning Programmes 11/24/2014 08:37AM
Announcement Unisa contact information 07/28/2011 01:28PM
Second Semester Assignment 1
July 24, 2011 03:10PM
Hi any second semester students here?

got a question:

when removing unit productions and we have

S --> A
A --> B | b
B --> a

I can easily understand that to remove the unit productions we get

S --> A gives S -> b thus removing S--> A
S --> A --> B gives S --> a thus removing S --> A --> B
A --> B gives A --> a thus removing A --> B

result is:

S --> b | a
A --> a
B --> a

but the assignment has something like this

S --> AA
A --> BB | B
B --> a

what do I do with the AA..?

should I go S --> AA gives

a) S --> B and thus a
b) S --> BB and thus aa

is this correct?

and what if B also --> aa? then a and b above should include all combinations S-->B (thus a | aa) and S --> BB aa | aaa | aaaa

sorry hope this makes some sense, I just need to know if what Im doing is correct, the example in the book doesn't do S -> AA types.

thanks in advance for any guidance

Danie van Eeden
------------------------
avatar Re: Second Semester Assignment 1
July 24, 2011 07:09PM
Is S -> AA a Unit production?

Maybe that will help a bit.
Re: Second Semester Assignment 1
July 24, 2011 09:01PM
erm.. yeah sorry 'bout that. Seems I'm to hasty. Thanks for the help.

Unit Production = nonterminal -> one nonterminal

now, without wanting to sound like an idiot..seeing as though its not a unit production (its got 2 non terminals), do we just leave it as it is? if yes, then we only have A --> B to worry about... but this seems to easy to be true. It does however seem counter productive to modify it into something containing unit productions just to remove them again.

My apologies if I seem nuts

Danie van Eeden
------------------------
avatar Re: Second Semester Assignment 1
July 24, 2011 10:58PM
You really shouldn't apologise for asking questions here. That's the whole point isn't it? Without decent questions what would anyone learn here? I just find that sometimes a question makes a better answer than a statement. I wasn't trying to complain or something like that. ... smile

For what it's worth I had some idea of what the answer might be because I've made the same mistake.

No, no, you sound like you're thinking, which nutters tend not to really do.

Hmm... Yes, I think you'd just leave it. If the question pertinently says "Get rid of the Unit Productions" then stick to what's asked, eh?

Of course the safest would be to review the two pages or so that cover this. Something says there might be some hidden problems in there, but I look and look and can't find them, so maybe I'm just being paranoid.
Re: Second Semester Assignment 1
July 25, 2011 06:59AM
lol smile nah, i understand. I just realized I wasn't thinking about what Im doing smile hence the apologies

appreciate the help though. will go do some more digging incase there' something more Im missing.
must say I seriously like the way the book is written - they tend to explain things very casually.

Danie van Eeden
------------------------
avatar Re: Second Semester Assignment 1
July 25, 2011 11:15AM
Yes, I reckon that book has made a lot of people decide they rather like old Daniel Cohen. He's casual but accurate. That's quite a feat.
Sorry, only registered users may post in this forum.

Click here to login