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

asked in Compiler Design by Junior (523 points)
recategorized by | 809 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 (17k 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 Loyal (6.6k points) | 1.1k views
+2 votes
1 answer
5
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
183,548 comments
68,745 users