The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
+2 votes

asked in Compiler Design by Junior (523 points)
recategorized by | 809 views
For 80 , I m getting (A),(B),(C),(D) all. And for 81, I m getting (B). Can anyone verify this?

1 Answer

+3 votes

80 . LR(1) item B---> a.B,a  is valid for " aaa ". 

 A---> a'.ß, a'' is valid for viable prefix let y if there is derivation S-rm*-->ØAw---> Øa'ßa''w

here y=Øa' here a'' is lookahead , which is first symbol of w so for given question 

S--> BB---> BaB--->--> Bab---> aBab-*-->aaaBab(rightmost derivation)  so here a''=a , w=ab ,Ø=aa,

viable prefix = aaa 

81. similar here S--> BB --> BaB--> BaaB 

so w=∊ ,a''=$  ,a'=a , Ø=Ba so

y=  Baa..


answered by Boss (17k points)
For the first part, can't it be

S -> BB, S-> BaB,S-> Bab, S -> aBab

This way, a is th prefix.
@Sonam , what is viable prefix ? Can you explain it with a simple example ??

Related questions

+2 votes
1 answer
asked Nov 12, 2016 in Compiler Design by KISHALAY DAS Loyal (6.6k points) | 1.1k views
+2 votes
1 answer
asked Dec 2, 2015 in Compiler Design by yes Active (1.8k points) | 825 views
Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
48,756 questions
52,850 answers
68,745 users