"It's because it is on a particular parse you have a single item; on another you may have two; etc... It becomes easier then to have an OrderedCollection containing one or more elements. The same code works."
yes I understand the intention. Now it clear and no longer confusing ;) "Which classes are you talking about? The node classes (PyAtomNode, PyPowerNode)?" Yes I was referring to node classes. I have to confess I have briefly looked at SmaCC classes cause it took quite a lot of time to understand the tutorial mainly because I wanted a deep understanding. "In practice, what you see with grammars in source code is often next to horrible... very long files, happily mixing a long grammar to dozens or hundreds of lines implementing actions (the { }) for each rule in the grammar." maybe it would be better to add the grammar of each node as class comment. This way it would be less necessary to look at the complete grammar. Not an ideal solution but it could help, at least it would in my case. I am also happy to report that I have made quite a lot of progress, I have been able to implement parsers for python lists and tuples, nested list and tuples taking numbers , floats and strings as values which are converted to OrderedCollections. Now I have started also parsing custom blender types like blender colors which are converted to pharo colors. Its fun because now I can use the new Pharo inspector to inspect Blender colors and the new inspector gives me a preview of the color too. Pharo is getting closer to Python and vice versa ;)