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

asked in Compiler Design by (437 points)
recategorized by | 829 views
0
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..

reference http://www.cs.clemson.edu/course/cpsc827/material/LRk/LR1.pdf

http://tinman.cs.gsu.edu/~raj/4340/sp12/LR1.pdf

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

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

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

Related questions

+2 votes
1 answer
1
asked Nov 12, 2016 in Compiler Design by KISHALAY DAS Active (4.9k points) | 1.1k views
+2 votes
1 answer
4
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
188,329 comments
75,113 users