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

asked in Compiler Design by (437 points)
recategorized by | 829 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 (16.9k 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 Active (4.9k points) | 1.1k views
+2 votes
1 answer
asked Dec 2, 2015 in Compiler Design by yes Active (1.2k points) | 847 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
49,783 questions
54,511 answers
75,113 users