Reputation: 388
I've seen this question asked multiple times, and also seen people "solve" it... but it either confused me or didn't solve my specific situation:
Here's approximately what's going on:
block: statement*;
statement: <bunch of stuff> | expressionStatement;
expression_statement: <more stuff, for example> | method_invoke;
method_invoke: expression LEFT_PAREN <args...> RIGHT_PAREN block;
expression: <bunch of stuff> | expression_statement;
Everything inside of the expression_statement that starts with an expression uses indirect left recursion that I do not know how to fix while still being able to use those syntaxes as statements so they'll be usable in blocks(It is possible to do something like Print("hello world");
On it's own(a statement), but also do something like int c = a + b.getValue()
as a part of an expression(an expression)...
How would I handle it differently?
If you need more info please let me know and I'll try my best to provide
Upvotes: 0
Views: 102
Reputation: 388
I knew that to solve Indirect Left-Recursion I'd have to duplicate one or more of the rules... I hoped there'd be a better way to handle it then what is written online and also said here, but there isn't. I ended up doing that and it worked, thank you
Upvotes: 0