Skip to main content



      Home
Home » Modeling » TMF (Xtext) » Method createSequence is exceeding the 65535 bytes limit(The code of method createSequence(EObject, EObject) is exceeding the 65535 bytes limit)
Method createSequence is exceeding the 65535 bytes limit [message #1564072] Wed, 14 January 2015 10:36 Go to next message
Eclipse UserFriend
Hi guys,

I am writing a grammar to support a in-house internal language but after adding some rules I got this error:

"The code of method createSequence(EObject, EObject) is exceeding the 65535 bytes limit"

I did some google and it seems that I need to turn on some options for the ANTLR Parser in order to split the code but neither of the following options works.

options = {
classSplitting=true
fieldsPerClass="200"
methodsPerClass="100"
}

I tried adding these options under XtextAntlrGeneratorFragment and XtextAntlrUiGeneratorFragment. I am using the latest version of Xtext 2.7.3

Do you have any clue about this?
Re: Method createSequence is exceeding the 65535 bytes limit [message #1564088 is a reply to message #1564072] Wed, 14 January 2015 10:48 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

the method is in YourDslSemanticSequencer right? then the options wont help since the class is not created by antlr.
so sounds like a bug/enhancement for me
Re: Method createSequence is exceeding the 65535 bytes limit [message #1564134 is a reply to message #1564088] Wed, 14 January 2015 11:22 Go to previous messageGo to next message
Eclipse UserFriend
Hi Christian,

You are right the method is in the SemanticSequencer class, do you know if this issue could be due to something wrong on my grammar? I only have 52 (ParserRule/DataTypeRules) and 6 terminals, maybe the problem is because the language has to support different expressions and I have recursive call among the rules. I based my grammar in some posts for expression, prefix operators and postfix operators.

Any work-around in mind?

Thanks & Regards,
Luis
Re: Method createSequence is exceeding the 65535 bytes limit [message #1564135 is a reply to message #1564088] Wed, 14 January 2015 11:22 Go to previous messageGo to next message
Eclipse UserFriend
Hi Christian,

You are right the method is in the SemanticSequencer class, do you know if this issue could be due to something wrong on my grammar? I only have 52 (ParserRule/DataTypeRules) and 6 terminals, maybe the problem is because the language has to support different expressions and I have recursive call among the rules. I based my grammar in some posts for expression, prefix operators and postfix operators.

Any work-around in mind?

Thanks & Regards,
Luis
Re: Method createSequence is exceeding the 65535 bytes limit [message #1564136 is a reply to message #1564135] Wed, 14 January 2015 11:24 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

that does not sound that big but of course recursion could make that tricky
Re: Method createSequence is exceeding the 65535 bytes limit [message #1564137 is a reply to message #1564136] Wed, 14 January 2015 11:25 Go to previous messageGo to next message
Eclipse UserFriend
p.s: do you have backtracking on?
Re: Method createSequence is exceeding the 65535 bytes limit [message #1564144 is a reply to message #1564137] Wed, 14 January 2015 11:28 Go to previous messageGo to next message
Eclipse UserFriend
I am not using backtracking I have the defaults options
Re: Method createSequence is exceeding the 65535 bytes limit [message #1564151 is a reply to message #1564144] Wed, 14 January 2015 11:33 Go to previous messageGo to next message
Eclipse UserFriend
do you make heavy use of unordered groups?

did you try to strip down your grammar? (minimal example)
otherwise it is very hard to give any hints without having a grammar
Re: Method createSequence is exceeding the 65535 bytes limit [message #1564183 is a reply to message #1564151] Wed, 14 January 2015 11:58 Go to previous messageGo to next message
Eclipse UserFriend
I am not using any unordered groups I only used alternatives.
The problem is if I remove some rules the grammar runs ok without any issue so I cannot extract a minimal example because the issue appears when I have several rules.

I enclose the recursive call between rules maybe that helps. If I uncomment any of the action that I have in Postfix rule I got the error

/*
* Expressions
*/
Expression:
SingleObject | LambdaExpression;

LambdaExpression returns Expression:
OrExpression ((
{MapLambda.element=current} "map" (("(" "(" (parameters+=VariableDefintion ("," parameters+=VariableDefintion)*)? ")" "->" expression=OrExpression ")")? | expression=OrExpression) |
{WhereLambda.element=current} "where" (("(" "(" (parameters+=VariableDefintion ("," parameters+=VariableDefintion)*)? ")" "->" expression=OrExpression ")")? | expression=OrExpression) |
{ReduceLambda.element=current} "reduce" (("(" "(" (parameters+=VariableDefintion ("," parameters+=VariableDefintion)*)? ")" "->" expression=OrExpression ")")? | expression=OrExpression) |
{GroupByLambda.element=current} "groupBy" (("(" "(" (parameters+=VariableDefintion ("," parameters+=VariableDefintion)*)? ")" "->" expression=OrExpression ")")? | expression=OrExpression) |
{OrderByLambda.element=current} "orderBy" (("(" "(" (parameters+=VariableDefintion ("," parameters+=VariableDefintion)*)? ")" "->" expression=OrExpression ")")? | expression=OrExpression) |
{FindLambda.element=current} "find" (("(" "(" (parameters+=VariableDefintion ("," parameters+=VariableDefintion)*)? ")" "->" expression=OrExpression ")")? | expression=OrExpression) |
{ScanLambda.element=current} "scan" (("(" "(" (parameters+=VariableDefintion ("," parameters+=VariableDefintion)*)? ")" "->" expression=OrExpression ")")? | expression=OrExpression) |
{MatchLambda.element=current} "match" (("(" "(" (parameters+=VariableDefintion ("," parameters+=VariableDefintion)*)? ")" "->" expression=OrExpression ")")? | expression=OrExpression) |
{DistinctByLambda.element=current} "distinctBy" (("(" "(" (parameters+=VariableDefintion ("," parameters+=VariableDefintion)*)? ")" "->" expression=OrExpression ")")? | expression=OrExpression)))*;

OrExpression returns Expression:
AndExpression (({Or.left=current} "or") right=AndExpression)*;

AndExpression returns Expression:
EqualityExpression (({And.left=current} "and") right=EqualityExpression)*;

EqualityExpression returns Expression:
IsExpression (({Equal.left=current} "==" | {NotEqual.left=current} "!=") right=IsExpression)*;

IsExpression returns Expression:
StringExpression (({Is.element=current} "is")
type = (
(":string"|":array"|":object"|":boolean"|":number"|":range"|":uri"|":datetime"|":localdatetime"|":date"|":localtime"|":time"|":timezone"|":period"|":null") |
(":empty"|":blank"|":even"|":odd"|":integer"|":decimal"|":leapYear")
)
(right=StringExpression)?
)*;

StringExpression returns Expression:
GreaterThanExpression (
(
{StartsWith.data=current} "startsWith" |
{EndsWith.data=current} "endsWith" |
{Matches.data=current} "matches" |
{Contains.data=current} "contains"
) filter=GreaterThanExpression)*;

GreaterThanExpression returns Expression:
LessThanExpression (({GreaterThan.left=current} ">" | {GreaterThanEqual.left=current} ">=") right=LessThanExpression)*;

LessThanExpression returns Expression:
AdditionSubtractionExpression (({LessThan.left=current} "<" | {LessThanEqual.left=current} "<=") right=AdditionSubtractionExpression)*;

AdditionSubtractionExpression returns Expression:
AppendExpression (({Plus.left=current} "+" | {Minus.left=current} "-") right=AppendExpression)*;

// TODO (ldebello) Review precedence
AppendExpression returns Expression:
RightLeftExpression (
(
{Append.data=current} "++" |
{Remove.data=current} "--"
) element=RightLeftExpression)*;

// TODO (ldebello) Review precedence
RightLeftExpression returns Expression:
MultiplicationDivisionExpression (({RightShift.left=current} ">>" | {LeftShift.left=current} "<<") right=MultiplicationDivisionExpression)*;

MultiplicationDivisionExpression returns Expression:
SplitExpression (({Multiply.left=current} "*" | {Division.left=current} "/") right=SplitExpression)*;

// TODO (ldebello) Review precedence
SplitExpression returns Expression:
AsExpression (({Split.data=current} "split") separator=AsExpression)*;

AsExpression returns Expression:
DefaultValueExpression (({As.element=current} "as")
type = (":string"|":array"|":object"|":boolean"|":number"|":range"|":uri"|":datetime"|":localdatetime"|":date"|":localtime"|":time"|":timezone"|":period"|":null")
(=>right=DefaultValueExpression)?
)*;

DefaultValueExpression returns Expression:
Prefixed (({DefaultValue.data=current} "default") default=Prefixed)?;

Prefixed returns Expression:
{UnaryMinus} "-" expression=Postfix |
{Negated} "not" expression=Postfix |
{SizeOf} "sizeOf" expression=Postfix |
{Trim} "trim" expression=Postfix |
{Upper} "upper" expression=Postfix |
{Lower} "lower" expression=Postfix |
Postfix;

Postfix returns Expression:
Atomic (
// Dot Selectors
=>({AttributeSelector.data=current} "..@" (attributeName=StringLiteral)?)+ |
=>({MetadataSelector.data=current} "..^" (attributeName=StringLiteral)?)+ |
// =>({StarSelector.data=current} "..*" attributeName=StringLiteral)+ |
// =>({DescendantsSelector.data=current} ".." attributeName=StringLiteral)+ |
// =>({DotSelector.data=current} "." attributeName=StringLiteral)+ |

// Bracket Selectors
// =>({AttributeSelector.data=current} "[@" (attributeName=StringLiteral)? "]")+ |
// =>({MetadataSelector.data=current} "[^" (attributeName=StringLiteral)? "]")+ |
// =>({StarSelector.data=current} "[*" attributeName=StringLiteral "]")+ |
=>({IndexSelector.data=current} "[" selector=SignedInteger "]")+ |
=>({RangeSelector.data=current} selector=Range)+

// =>({DynamicSelector.data=current} "[" "(" expression=Expression ")" "]")+ |
// =>({FilterSelector.data=current} "[" "?" "(" expression=LambdaExpression ")" "]")+
)* (
{KeyExistsModifier.data=current} "?" |
{NullUnsafeModifier.data=current} "!"
)?;

Atomic returns Expression:
Literal | Variable | Object | Range | Array| VariableAssigment | "(" Expression ")";

Re: Method createSequence is exceeding the 65535 bytes limit [message #1564255 is a reply to message #1564183] Wed, 14 January 2015 12:48 Go to previous messageGo to next message
Eclipse UserFriend
something like

LambdaExpression returns Expression:
OrExpression 
(({MapLambda.element=current} "map")|
	({WhereLambda.element=current} "where")|
	({ReduceLambda.element=current} "reduce")|
	({GroupByLambda.element=current} "groupBy")|
	({OrderByLambda.element=current} "orderBy")|
	({FindLambda.element=current} "find")|
	({ScanLambda.element=current} "scan")|
	({MatchLambda.element=current} "match")|
	({DistinctByLambda.element=current} "distinctBy")
	
) (("(" "(" (parameters+=VariableDefintion ("," parameters+=VariableDefintion)*)? ")" "->" expression=OrExpression ")")? | expression=OrExpression) ;



should save you some lines

Re: Method createSequence is exceeding the 65535 bytes limit [message #1564287 is a reply to message #1564255] Wed, 14 January 2015 13:14 Go to previous messageGo to next message
Eclipse UserFriend
Hi Christian,

That was great; it saved me 600 lines , anyway I think I will have to face the same issue in near future because I need to continue adding some functionality to my grammar, I will try to look for the original code which is generating this class in order to include some logic to split the body of each IF in a different method.

Do you know if that part is open source code?

Thanks & Regards,
Luis
Re: Method createSequence is exceeding the 65535 bytes limit [message #1564294 is a reply to message #1564287] Wed, 14 January 2015 13:17 Go to previous messageGo to next message
Eclipse UserFriend
did you try to split up the grammar using inheritance?
Re: Method createSequence is exceeding the 65535 bytes limit [message #1564295 is a reply to message #1564294] Wed, 14 January 2015 13:19 Go to previous messageGo to next message
Eclipse UserFriend
for the generator: have a look at org.eclipse.xtext.generator.serializer.AbstractSemanticSequencer
Re: Method createSequence is exceeding the 65535 bytes limit [message #1564321 is a reply to message #1564295] Wed, 14 January 2015 13:39 Go to previous messageGo to next message
Eclipse UserFriend
First of all, thanks a lot for your time and help !!!

I didn't try to split my grammar because I read that I need to create a new project to split my grammar and I do not wanted to do that.

Do you know if there is any way of having two grammars in the same project?

Regards,
Luis
Re: Method createSequence is exceeding the 65535 bytes limit [message #1564334 is a reply to message #1564321] Wed, 14 January 2015 13:47 Go to previous messageGo to next message
Eclipse UserFriend
you can have multiple language sections in the workflow.
Re: Method createSequence is exceeding the 65535 bytes limit [message #1564360 is a reply to message #1564334] Wed, 14 January 2015 14:10 Go to previous messageGo to next message
Eclipse UserFriend
Thanks a lot for the help I will review that option.

Regards,
Luis
Re: Method createSequence is exceeding the 65535 bytes limit [message #1565291 is a reply to message #1564183] Thu, 15 January 2015 02:34 Go to previous messageGo to next message
Eclipse UserFriend
Hi Luis,

generally speaking, I'd recommend to use fewer types and do the
dispatching according to the state of the model, e.g. instead of

StringExpression returns Expression:
GreaterThanExpression (
(
{StartsWith.data=current} "startsWith" |
{EndsWith.data=current} "endsWith" |
{Matches.data=current} "matches" |
{Contains.data=current} "contains" )
filter=GreaterThanExpression)*;

you could do something like

StringExpression returns Expression:
GreaterThanExpression (
{StringExpression.data=current} operator=StringOp
filter=GreaterThanExpression
)*;

StringOp: 'startsWith' | 'endsWith' | 'matches' | 'contains'.

Also you may want to look into Xbase and learn from that. It seems to me
as if you bake the API of your language directly into the grammar which
could be considered bad practice and may cause maintainability issues in
the long run.

Best,
Sebastian
--
Looking for professional support for Xtext, Xtend or Eclipse Modeling?
Go visit: http://xtext.itemis.com
Re: Method createSequence is exceeding the 65535 bytes limit [message #1590837 is a reply to message #1565291] Thu, 29 January 2015 01:57 Go to previous messageGo to next message
Eclipse UserFriend
I filed https://bugs.eclipse.org/bugs/show_bug.cgi?id=458705 for that
Re: Method createSequence is exceeding the 65535 bytes limit [message #1591042 is a reply to message #1590837] Thu, 29 January 2015 04:33 Go to previous messageGo to next message
Eclipse UserFriend
Hi Christian,

As you pointed out in the comment above for the usage of unordered groups, I have some. Also your solution of "Quote:
you can have multiple language sections in the workflow
." can be applied. But I dont know the exact changes to be made in the workflow. Can you give an example, if it is possible.!!

Regards
Puneet
Re: Method createSequence is exceeding the 65535 bytes limit [message #1591102 is a reply to message #1591042] Thu, 29 January 2015 05:11 Go to previous message
Eclipse UserFriend
hi, no i dont have a example.
did you have a look at the workflow of xbase?
Previous Topic:Xtext Grannar
Next Topic:NPE at PreferenceStoreWhitespaceInformationProvider.getLineSeparatorPreference()
Goto Forum:
  


Current Time: Mon Nov 10 09:05:16 EST 2025

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

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

Back to the top