Closed marty-friedman closed 4 months ago
Is it related to some left recursion magic that is going on with these expressions, so that it won't let me use any particular kind of expression directly, instead always replacing it with the parent 'expression'. In that case, is the only way to achieve the expected behavior to implement some kind of inspection after the parsing takes place to explicitly check the type of expression at the root level?
Is it related to some left recursion magic that is going on with these expressions, so that it won't let me use any particular kind of expression directly
It's related to Compact expression parsing with priorities. A special parser generator mode optimized for expressions
Hi, what I'm currently trying to solve is the parser generation logic with grammar-kit for whatever reason replacing rules with their parent parsing method. Here is the grammar:
In this example as can be seen, the file is expected to have zero or more assignment/super-call/function-call/method-call expressions each followed by a semicolon. However, this is not what grammar-kit is generating. Instead, in the parser code I can see:
For whatever reason instead of having separate methods for assignment/method-call expressions it uses the generic 'expression' (yet somehow it does generate methods for function/super-call) and it results in behavior which is explicitly defined by the grammar as incorrect, i.e. it sees for example '2;' and '2+2;' as valid statements.