| Summary: | Too many constants despite fieldsPerClass = "200" | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [Modeling] TMF | Reporter: | Peter Feiler <phf> | ||||||
| Component: | Xtext | Assignee: | Project Inbox <tmf.xtext-inbox> | ||||||
| Status: | CLOSED FIXED | QA Contact: | |||||||
| Severity: | major | ||||||||
| Priority: | P3 | CC: | phf, sebastian.zarnekow | ||||||
| Version: | unspecified | Flags: | sebastian.zarnekow:
indigo+
|
||||||
| Target Milestone: | SR2 | ||||||||
| Hardware: | PC | ||||||||
| OS: | Windows XP | ||||||||
| See Also: | https://bugs.eclipse.org/bugs/show_bug.cgi?id=349992 | ||||||||
| Whiteboard: | |||||||||
| Attachments: |
|
||||||||
|
Description
Peter Feiler
Created attachment 201053 [details]
zip file with four projects to demo the bug
The zip file contains four projects.
* a project with the Ecore model
* a project containing the xtext grammar and mwe2 file
* the two other Xtext generated projects with empty structures.
Unzip & import into a workspace folder.
Then generate the Xtext editor.
You may need to increase your heap space setting when running mwe2. I am running with a setting of -Xmx1300m. Your grammar contains some surprising, repeated patterns, e.g. you seem to use syntactic predicates for basically any decision point and enable backtracking too. That's not necessary. I bet you can safely remove every explicit predicate without modifying the behavior of the generated parser. Furthermore you seem to use a duplicated expression tree at the very same place in the language which does not look right to me. Please revisit your boolean logic there. Eliminating the redundancy will reduce the file size too. Last but not least I'd recommend to explore the DebugAntlrGeneratorFragment in combination with AntlrWorks to tackle the ambiguities. It would help if you could disable backtracking. Hi Sebastian, at first I tried to avoid using back tracking, thus, the predicates and I had not gotten around to removing them after turning on backtracking. I have removed them all. The boolean expressions syntax has an ambiguity in the the use of parentheses. They orignally addressed it by not allowing parentheses at the outmost level of boolean expressions - thus the strange rules. They did process models correctly under back tracking. I am working with the AADL standard committee to disambiguate those rules differently. I took the liberty to make chagnes that allow me to turn off back tracking. As you noticed some rules are quite repetitive, e.g., for component types and component implementations. Different specific component types use different subsets of elements, which are enforced by the Ecore model. I have a variant of the rules where the common backend for the different rules is defined as part of the component type rule - I have this variant included in the newly attached grammar. However, those rules resulted in another problem, which I reported under bug 353969. I have attached the revised grammar. As stated above it does not use backtracking and a simplified boolean grammar, as well as less repetition for component types by pulling the common backend up into a parent rule. I still get the "too many constants" issue. We do have a hand-crafted ANTLR grammar which the person used syteactic and semantic predicates to resolve the issue. Unfortunately I am working with a langauge standard that requries committee approval for changes. Created attachment 201481 [details]
revised AADL grammar
I revised the grammar as per suggestions.
I have a variant of the grammar where the property expression/association portion is in a separate grammar that is mixed in to the core language. It will also be reused in language extensions to the core language, such as fault modeling associated with core architecture models. Splitting of the grammar did not help with respect to the "too many constants" issue. Pushed to master.
Introduced a new option methodsPerClass in AntlrOptions which allows to force a super-type extraction. Default is 5000 methods per class. The AADL ui parser (generated from the 'revised AADL grammar') has approx 7800 methods.
The only necessary option to generate parsers for AADL is now:
options = {
classSplitting = true
}
Closing all bugs that were set to RESOLVED before Neon.0 Closing all bugs that were set to RESOLVED before Neon.0 |