I am revising for an exam tomorrow, and going over a previous years one.
In the test was the grammar.
Expression -> Foo "+" Bar "end"
Foo -> [a-z0-9]+ | Expression
Bar -> Expression Foo | a*b*c+
I have tried and spent hours researching on how to do it, but can't figure it out.
I have had a look at replacing things with epsilion and that, but don't feel confident.
I think that I need to create a Foo' and a Bar' and then just add in the epsilon rules, but I am not sure.
Could somebody please show me (simply)_how to change it to an LL(1) capable grammar
Thanks in advance
As i remember LL-1 grammar look ahead in 1 symbol. Your goal to eliminate ambiguity and left recursion. All that you need - use left factorization. Take a look this first.