222 views

S→ aAC | bB

A→ Abc| Abd | e

B→ f | g

C→ h | i

 Non terminal First Follow S {a,b} {$} A {e} {b,h,i} B {f,g} {$} C {h,i} {\$}

isn’t this grammar left recursive? (production number 2)

and in LL(1) we can’t have left recursion and non-determinism, right?
Yes the grammar is left recursive so it cant be LL(1).

You can check it  by creating the LL(1) parsing table for this production.
i am aware of that. what i really meant was if the grammar itself isn’t LL(1) itself then are the first and follow you calculated valid?

@juniorG  Before calculating the first and follow functions, eliminate Left Recursion from the grammar, if present.

1
1,243 views