No, that is exactly what I did and it does not work. The number of instance variables takes the super classes into account. I splitted it into two classes: One having 89 and the second having 163 instance variables. The sum is 252. If you take one instVar from PPParser and one from PPDelegatingParser that makes a total of 254. And that is the number I get if I do
MyParser instSize
while
MyParser instVarNames size = 163
The java parser has only 195 instance variables so no problem. So either I did something completely wrong or I need a new strategy.
Norbert
Am 07.06.2011 um 12:35 schrieb Tudor Girba:
Hi,
Alberto encountered this when he worked on the Java parser. The solution is to split the parser into multiple classes that inherit from each other.
For example, in the mentioned example we have: PPJavaLexicon PPJavaSyntax PPJavaParser
Cheers, Doru
On 7 Jun 2011, at 12:02, Norbert Hartl wrote:
I learned something today. While talking about the maximum number of instance variabes I always thought it is a limit per class. But now I know it is a limit on an object. As I reached 230 instance variables I started to split the parser into two. But now I reached the limit and cannot add instance variables.
I need some ideas about how to structure the parser. I think it will be too hard to find parts of the grammar that are distinct so it would be possible to separate them into different classes. Another way would be to access some of the parser via method calls instead of accessing the instVar parsers.
So does anybody has some experience in how to structure parsers?
thanks,
Norbert _______________________________________________ Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev
-- www.tudorgirba.com
"In a world where everything is moving ever faster, one might have better chances to win by moving slower."
Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev