Eliminating Left Recursion without the Epsilon

by   James Smith, et al.

The standard algorithm to eliminate indirect left recursion takes a preventative approach, reorganising a grammar in such a way that indirect left recursion is no longer possible, rather than eliminating it only as and when it occurs. This approach results in many of the grammar's rules being lost, however, so that the resulting parse trees are often devoid of the detail that the grammar was supposed to pick out in the first place. To avoid this pitfall, we extend a revised version of the standard algorithm to eliminate immediate left recursion to a recursive algorithm to explicitly eliminate indirect left recursion. By taking this approach, all of the grammar's original rules are retained, resulting in parse trees that are still useful in practice. A novel quirk of this approach is that the usual empty definitions with ϵ parts are eschewed in favour of optional parts in the right recursive rules that the algorithm generates.



page 1

page 2

page 3

page 4


Pika parsing: parsing in reverse solves the left recursion and error recovery problems

A recursive descent parser is built from a set of mutually-recursive fun...

Gradient Descent over Metagrammars for Syntax-Guided Synthesis

The performance of a syntax-guided synthesis algorithm is highly depende...

Learning Highly Recursive Input Grammars

This paper presents Arvada, an algorithm for learning context-free gramm...

A right-to-left type system for mutually-recursive value definitions

In call-by-value languages, some mutually-recursive value definitions ca...

Minimizing LR(1) State Machines is NP-Hard

LR(1) parsing was a focus of extensive research in the past 50 years. Th...

3D Scene Grammar for Parsing RGB-D Pointclouds

We pose 3D scene-understanding as a problem of parsing in a grammar. A g...
This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.