Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Limitation on recursive objects?(Limitation on recursive objects?)
Limitation on recursive objects? [message #1855498] Tue, 18 October 2022 12:07 Go to next message
Thomas Landuyt is currently offline Thomas LanduytFriend
Messages: 11
Registered: May 2021
Junior Member
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 #1855504 is a reply to message #1855498] Tue, 18 October 2022 18:35 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14651
Registered: July 2009
Senior Member
I always recommend to actually measure (profile) where the time in spent

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Limitation on recursive objects? [message #1855510 is a reply to message #1855504] Wed, 19 October 2022 06:36 Go to previous messageGo to next message
Thomas Landuyt is currently offline Thomas LanduytFriend
Messages: 11
Registered: May 2021
Junior Member
In attachment i included partial of the jprofiler
Re: Limitation on recursive objects? [message #1855524 is a reply to message #1855510] Wed, 19 October 2022 14:17 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14651
Registered: July 2009
Senior Member
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.


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Limitation on recursive objects? [message #1855525 is a reply to message #1855524] Wed, 19 October 2022 14:42 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14651
Registered: July 2009
Senior Member
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))?;


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Limitation on recursive objects? [message #1855542 is a reply to message #1855525] Thu, 20 October 2022 05:46 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7648
Registered: July 2009
Senior Member
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
Previous Topic:Create and configure instances
Next Topic:whether Xtext/Xtend have some ways to develop DSL debugger
Goto Forum:
  


Current Time: Fri Feb 23 10:28:09 GMT 2024

Powered by FUDForum. Page generated in 0.02853 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top