Skip to content
Snippets Groups Projects

Indirect-Direct Left Recursion Eliminator

Usage

I have here a python script that removes direct and indirect left recursion from a grammar.

The input is a file with the grammar structured as such:

[nonTerminal] -> [rule1] | [rule2] | ... | [ruleN] A -> aB | empty B -> BC | a C -> AC | b . . .

I've linked a few testing files as well for a better idea on the formatting. The empty character is just represented by the word empty. The command to run the script is as follows:

ILRE.py [input file] [output file]