-
I learn about that antlr4 is also a variant of LL(*) parser generator and the LL(*) grammar cannot deal with left-recursion, even direct left-recursion. The G4 format can express the left-recursive grammar, so there must be some sugar right? If so, is there any tool to convert G4 format to a non-left-recursive grammar, e.g. LL(*) format. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
At one point, I had a tool that removed direct-left recursion using the usual procedure outlined in the Dragon Book. It also converted recursions into kleene closures, which is different than removing direct-left recursion. I can't tell which you are looking for. Unfortunately, I haven't updated the tool when I rewrote the use of Antlr parse trees into something much more efficient for editing, and would need to be redone to separate the two refactorings, and offer the inverse refactoring. |
Beta Was this translation helpful? Give feedback.
-
I just found this website, and will create a list of useful grammar-related websites, including these. https://cyberzhg.github.io/toolbox/left_rec |
Beta Was this translation helpful? Give feedback.
At one point, I had a tool that removed direct-left recursion using the usual procedure outlined in the Dragon Book. It also converted recursions into kleene closures, which is different than removing direct-left recursion. I can't tell which you are looking for. Unfortunately, I haven't updated the tool when I rewrote the use of Antlr parse trees into so…