hi
I want to write a program to gives grammar as input and change it to LL1.
my problem is converting to LL1 I don't have any algorithm to convert. I earn grammar from some input text by a simple text analyzer but how I can change it to LL1 ? is there any algorithm that is clear to implement.
views:
81answers:
1
A:
The dragon book: Compilers, Principles, Techniques and Tools by Aho, Sethi and Ullman has a chapter (titled Syntax Analysis) which explains a procedure to eliminate left recursion and another procedure to left factor a context free grammar.
The resulting grammar is suitable for LL parsing.
I suggest you read that chapter in the book and see if you can convert it into code.
Moron
2010-06-03 06:36:25