Limitation on recursive objects? [message #1855498] |
Tue, 18 October 2022 12:07  |
Eclipse User |
|
|
|
Hi,
we have some kind of sample ifstatement in our project
IfStatement:
'if' condition=ValueExpression then=BlockAnnotatedStatement => ('else' else=(BlockAnnotatedStatement|IfAnnotatedStatement))?;
now the problem as if we have a lot of else if statements it seems that the build keeps hanging.
Is there any limitation on the amount of depth we can go into a xtext object?
Kind regards,
|
|
|
|
|
Re: Limitation on recursive objects? [message #1855524 is a reply to message #1855510] |
Wed, 19 October 2022 14:17   |
Eclipse User |
|
|
|
unfortunately i dont have a jprofiler lic.
looking with the eval version
i dont see any profiling from within eclipse there.
so i assume the answer is yes. if you nest too deep, then calling the parser will be slow.
the question is: is the problem in eclipse the parser or something else
i see there is 35% spent in the lexer.
|
|
|
Re: Limitation on recursive objects? [message #1855525 is a reply to message #1855524] |
Wed, 19 October 2022 14:42   |
Eclipse User |
|
|
|
btw did you try to use a First Token Set Predicate (->) instead of the Syntactic Predicates (=>)
IfStatement:
'if' condition=ValueExpression then=BlockAnnotatedStatement (->'else' else=(BlockAnnotatedStatement|IfStatement))?;
|
|
|
Re: Limitation on recursive objects? [message #1855542 is a reply to message #1855525] |
Thu, 20 October 2022 05:46  |
Eclipse User |
|
|
|
Hi
The underlying technology of Xtext is LL and so right recursion is good and left recursion bad. Through its * operator Xtext can support a simple effective left recursion. But I suspect that the underlying conversions/back-tracking are troublesome and quadratic.
For OCL, I found some ridiculously nested expressions in stylized auto-generated code took ages and so reformulated the grammar to parse a 'wrong' Concrete Syntax that Xtext could create efficiently. The 'wrong' CS is corrected during the CS to Abstract Syntax conversion.
Regards
Ed Willink
|
|
|
Powered by
FUDForum. Page generated in 0.02764 seconds