0 votes 0 votes Is following grammar LR(1)? S-> asa | bS |epsilon Compiler Design compiler-design parsing lr-parser descriptive testbook-test-series + – Ajay Jadhav asked Nov 25, 2017 • retagged Jun 22, 2022 by Lakshman Bhaiya Ajay Jadhav 529 views answer comment Share Follow See all 3 Comments See all 3 3 Comments reply Akash Mittal commented Nov 25, 2017 reply Follow Share not lr(1) 1 votes 1 votes vamp_vaibhav commented Dec 8, 2017 reply Follow Share Bhavna.. If the grammar is LL(1)->LR(1) see the direction is one sided.. Which means if grammar is not LL(1) we cannot conclude LR(1). 0 votes 0 votes just_bhavana commented Dec 8, 2017 reply Follow Share @vaibhav yes true !! It was my mistake 0 votes 0 votes Please log in or register to add a comment.
2 votes 2 votes This is definitely not LL(1) because FOLLOW(S) and FIRST(S) sets are not disjoint. It's not LR(1) also as shown in the following snapshot, there is S/R conflict in second state: Manu Thakur answered Dec 7, 2017 Manu Thakur comment Share Follow See all 0 reply Please log in or register to add a comment.
1 votes 1 votes At initial state itself there is shift reduce conflict on lookahead symbol $. Hence not LR(1). Ashwin Kulkarni answered Nov 25, 2017 Ashwin Kulkarni comment Share Follow See all 4 Comments See all 4 4 Comments reply Sahil1994 commented Dec 7, 2017 reply Follow Share table will be @Ashwin Kulkarni a b $ I0 S2 S3 R3 Sir, My query is how this will be Shift Reduce Conflict as there is single entry in each cell...? 0 votes 0 votes Manu Thakur commented Dec 7, 2017 reply Follow Share because conflict is not in state I0, it's in state I2 if you construct the table further in I2 you will get Shift-Reduce conflict 0 votes 0 votes Sahil1994 commented Dec 8, 2017 reply Follow Share yup Thanks i was bit confused at Intial State I0 only.. 0 votes 0 votes vamp_vaibhav commented Dec 8, 2017 reply Follow Share Ashwin shift reduce conflict won't arise for $ symbol.. It will be for symbol a.. In the following state 0 votes 0 votes Please log in or register to add a comment.