|
|
|
|
|
|
|
|
Re: Error The code for the static initializer is exceeding the 65535 bytes limit on the UI grammar [message #1065921 is a reply to message #1065879] |
Fri, 28 June 2013 10:38 |
Christian Mauceri Messages: 22 Registered: May 2012 Location: Paris |
Junior Member |
|
|
So for those reading this thread I summarize. ANTLR grammar generate their parser as DFA written in Java, the problem is java machine has an inherent limitation such that methods cannot exceed 64K. As your grammar grows you can get DFA exceeding this limitation, XText provides an option to split methods and fields in order ANTLR produces smaller DFA methods, but there are two ANTLR parsers produced by XText, one directly corresponding to the DSL grammar and one corresponding to the UI and the settings must be given separately for both of them. In the DSL generator mwe2, the two fragments are :
- parser.antlr.XtextAntlrGeneratorFragment
- parser.antlr.XtextAntlrUiGeneratorFragment
For instance, in my case, I wrote :
fragment = parser.antlr.XtextAntlrGeneratorFragment auto-inject {
options = {
// backtrack = true
classSplitting=true
fieldsPerClass = "100"
methodsPerClass= "100"
}
}
fragment = parser.antlr.XtextAntlrUiGeneratorFragment auto-inject {
options = {
// backtrack = true
classSplitting=true
fieldsPerClass = "100"
methodsPerClass= "100"
}
in the file:
/com.ibm.jrules.xtext.iros/src/com/ibm/jrules/xtext/iros/GenerateIROS.mwe2
standing next to my grammar file:
/com.ibm.jrules.xtext.iros/src/com/ibm/jrules/xtext/iros/IROS.xtext
One must be careful with the variables fieldsPerClass and methodsPerClass, too small values generates error, you can also (what happens to me) have grammar producing sufficiently small DFAs but generating too big UI grammar and only the second settings need to be given.
[Updated on: Fri, 28 June 2013 10:44] Report message to a moderator
|
|
|
Powered by
FUDForum. Page generated in 0.04544 seconds