Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » [Xtext] static initializer size problem in generated parser code
[Xtext] static initializer size problem in generated parser code [message #57078] Sun, 12 July 2009 19:23 Go to next message
Derek Palma is currently offline Derek PalmaFriend
Messages: 141
Registered: July 2009
Senior Member
Hi,

Recently I get the following compilation error when building my Xtext
project:

the code for the static initializer is exceeding the 65535 bytes limit

I have had this compilation error before in other contexts and it means what
it says. There is to much static data to represent in the currently defined
..class format. However, I have not checked if there are any ways to work
around this with the compiler. The file this error is reported for what
seems to be the generated source for antlr: Internet<MyDsl>Parser.java in
the ...parser.antlr.internal package.

If I comment out parts of my xtext grammar the message goes away so I
suppose there is nothing I can do but try to make my grammar more compact.

Any ideas about how to work around this? Unfortunately I am kind of stuck if
I can't continue enhancing the grammar. Just trying to think about how I
could work around this without aborting this.

Any ideas appreciated.
Thanks,
Derek
Re: [Xtext] static initializer size problem in generated parser code [message #57233 is a reply to message #57078] Mon, 13 July 2009 06:52 Go to previous messageGo to next message
Knut Wannheden is currently offline Knut WannhedenFriend
Messages: 298
Registered: July 2009
Senior Member
Hi Derek,

This Java limit is easily exceeded by the code generated by ANTLR for
large grammars. In ANTLR 3.1 a grammar composition feature
(http://www.antlr.org/wiki/display/ANTLR3/Composite+Grammars) was added
which would allow to overcome this problem.

Xtext is currently based on ANTLR 3.0, but I think it should be
investigated if this new feature can be aligned with Xtext grammar mixins.

But for now you will probably have to manually edit the generated code
:-( You could also check if the hint in this ANTLR issue is of any help:
http://www.antlr.org/jira/browse/ANTLR-75.

Regards,

--knut

Derek Palma wrote:
> Hi,
>
> Recently I get the following compilation error when building my Xtext
> project:
>
> the code for the static initializer is exceeding the 65535 bytes limit
>
> I have had this compilation error before in other contexts and it means
> what it says. There is to much static data to represent in the currently
> defined .class format. However, I have not checked if there are any ways
> to work around this with the compiler. The file this error is reported
> for what seems to be the generated source for antlr:
> Internet<MyDsl>Parser.java in the ...parser.antlr.internal package.
>
> If I comment out parts of my xtext grammar the message goes away so I
> suppose there is nothing I can do but try to make my grammar more compact.
>
> Any ideas about how to work around this? Unfortunately I am kind of
> stuck if I can't continue enhancing the grammar. Just trying to think
> about how I could work around this without aborting this.
>
> Any ideas appreciated.
> Thanks,
> Derek
Re: [Xtext] static initializer size problem in generated parser code [message #62909 is a reply to message #57233] Thu, 23 July 2009 09:08 Go to previous messageGo to next message
Stefano Cottafavi is currently offline Stefano CottafaviFriend
Messages: 57
Registered: July 2009
Member
Hi,
I actually came across the same problem. I have a quite expensive grammar
with a lot of literal keywords (such as "FixedReferenceFrame"
"RigidiBodyDeformation" and so on...) I have to match.

I was wondering if someone has been able to solve the problem and how (if
"manually" is the case).
Also, how about the use of antlr3.1 instead of the actual 3.0? is this
critical? how can be done?

Thanks
Stefano
Re: [Xtext] static initializer size problem in generated parser code [message #62944 is a reply to message #62909] Thu, 23 July 2009 16:59 Go to previous message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
Hi Stefano,

I'm not aware of an existing solution for this problem. It may be
possible to rewrite your grammar, extract common sequences into terminal
rules or something similar. But I'm afraid this will not work out very well.
There are plans (nothing fixed so far) to update Antlr to v3.1.3, dunno
whether this would help.

Regards,
Sebastian

--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com

Am 23.07.2009 11:08 Uhr, schrieb Stefano Cottafavi:
> Hi,
> I actually came across the same problem. I have a quite expensive
> grammar with a lot of literal keywords (such as "FixedReferenceFrame"
> "RigidiBodyDeformation" and so on...) I have to match.
>
> I was wondering if someone has been able to solve the problem and how
> (if "manually" is the case).
> Also, how about the use of antlr3.1 instead of the actual 3.0? is this
> critical? how can be done?
>
> Thanks
> Stefano
Previous Topic:[Xtext] Linking & implied imports
Next Topic:Xtext Editor as a standalone application?
Goto Forum:
  


Current Time: Fri Aug 16 16:40:15 GMT 2024

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

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

Back to the top