Skip to content
Daniël te Winkel edited this page Oct 7, 2023 · 1 revision

LL parser and left recursion

LL parser (as generated by CSLY) does not handle left recursion : it goes infinite recursion and stackoverflow.

CSLY and left recursion

To easen left recursion handling, CSLY introduces 2 features :

  • Expressions parsing : writing expressions parser is tedious as it needs to manage left associativity that by construction is left recursive. CSLy introduces a way to define an expression parser that manages automatically left associativity.
  • Left recursion detection : when building a parser, CSLY will check for direct or indirect left recursion and fails the build if it find one case, reporting the left recursion path. You can then rework your grammar to handle it.