Parsing issue
Closed this issue · 2 comments
I am writing a parser for the smalltalk language and am having an problem with the following equivalent rules. One works (unaryExpr2) and the other (unaryExpr) parses short. Thanks!
ometa STParser {
tokRule = ...,
primary = ...,
unarySel = ...,
...
// does not work
unaryObjExpr = unaryExpr | primary,
unaryExpr = unaryObjExpr:mexpr tokRule('unarySel'):sel -> [`send, mexpr, sel],
// works
unaryExpr2 = (unaryExpr2 | primary):mexpr tokRule('unarySel'):sel -> [`send, mexpr, sel],
...
}
STParser.matchAll('56 double factorial', 'unaryExpr') =
[send, [number, 56], [selector, double]]
STParser.matchAll('56 double factorial', 'unaryExpr2') =
[send, [send, [number, 56], [selector, double]], [selector, factorial]]
Hi, Charlie The problem is that in the version that doesn't work, you have indirect left recursion, which is not supported in OMeta/JS.
Hi,
I wasn't aware of that. Thanks for your timely response. Best!
On Thu, Aug 13, 2015 at 3:09 PM, Alessandro Warth notifications@github.com
wrote:
Hi, Charlie The problem is that in the version that doesn't work, you have
indirect left recursion, which is not supported in OMeta/JS.—
Reply to this email directly or view it on GitHub
#23 (comment).
~Charlie