Removing left recursion in the context of Free Grammar

Trying to figure out how to remove left recursion in the context of free grammars. I'm used to certain forms, but I have a little dazed.

S --> S {S} S | (A) | a
A --> {S} A | epsilon

I also need to develop a decent parser that I can do. However, figuring out this left recursion (especially on the first), I got confused.

+3
source share
2 answers

There is an interesting Wikipedia article on left recursion. It also has a section on deleting left recursion for non-contextual grammars.

http://en.wikipedia.org/wiki/Left_recursion

0
source

Try the following:

S --> a [ { S } S ]
    | ( [ A ] ) [ {S} S ]


A --> { S } [ A ]
0
source

Source: https://habr.com/ru/post/1767279/


All Articles