The Gateway to Computer Science Excellence
0 votes
186 views
Give a grammar which is LL(1) but not LALR(1) .
in Compiler Design by Boss (25.7k points) | 186 views

1 Answer

+1 vote

After some googling, I found this grammar to be LL(1) but not LALR

S -> (X | E] | F)
X -> E) | F]
E -> A
F -> A
A -> ε

LALR fails because there is reduce reduce conflicts in E and F productions.

With LL(1), decision is made based on the FIRST set of alternatives where ')' and ']' falls in different set of alternatives.

Credits: stackoverflow

by Active (1.1k points)
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
50,737 questions
57,356 answers
198,482 comments
105,252 users