S -> AS | b

A -> SA | a

I get FIRST of S = {a,b} for S->AS and FIRST of S = {b} for S->b

Hence FIRST(AS) ∩ FIRST (b) is not a disjoint This is not LL(1)

But I checked this site http://smlweb.cpsc.ucalgary.ca/start.html and this shows the grammar is LL(1). enter image description here Here I am confused!

Is it LL(1) or not?


That website uses a different notation than what you assumed. This would be the correct input:

S -> A S | b.
A -> S A | a.

You entered AS (and SA) which it does not recognize as A followed by S, but as a single nonterminal named AS.

With that input it correctly says that the language is not $\text{LL}(1)$.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.