Valid production replacement for LL(1)

Asked

Viewed 46 times

0

I have the following production: S if E then S Else S fi | if E then S fi | K

Considering ε as the empty sentence, which would be a valid substitution to obtain an equivalent grammar that is LL(1)?

  • 1

    Can you specify further what is the question you have? What have you tried to do? Because you need an LL(1 grammar)?

  • The grammar above has to be converted to LL(1). I tried to use methods to make the replacements valid. I need these methods because the production generates an intersection between First(αβ) and First(αδ) (two "First"), which is not valid for LL(1).

  • I seem to have found the answer: [breakline]S if E then S R fi | K [breakline] R Else S | ε

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.