Hi Kilon,

Le 03/03/2015 13:33, kilon alios a écrit :

"Because this two productions define a list of stmt (possibly empty) and
the AST generation code notices that, so it adds an s to statement and
prepare that instance variable to be an OrderedCollection."

yes but I find it a bit misleading because even when there is a single
element it still going to create an OrderedCollection and still add "s"
to the name of the variable.

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.

By they way I have been successful into implementing , with your help, a
parser that parses python lists into pharo ordered collections. Python
tuples and dictionaries are next. Have not implemented nesting types but
that is very close too.

Took me a lot of time to understand the syntax of SmaCC and moreover to
be able to understand the grammar used for the PythonParser2. I decided
not to change the grammar since it can do what I want as it is and
augment any additional parsing with my own classes.

Now I understand the meaning of tests, PyAtomNode and more importantly
PyPowerNode.

My overall experience with Smacc has been quite positive , the
documentation is in a good state though I would like more practical
examples especially on the matter of visitor. I love the Smacc syntax,
its compact , readable and fairly easy to understand. I really like the
design of the classes , make sense and are predictable.

Which classes are you talking about? The node classes (PyAtomNode, PyPowerNode)?

A final question is how up to date in the configuration loaded with
configuration browser.

I need to check that one. My approach for the moment is that whatever is done with SmaCC is at constant api, as much as possible.

The only thing I really missed from Smacc is a specialised to help me
browse the huge python grammar. Scrolling around became very tedious .

Yes, I agree. A folding tree or something like that...

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.

Thierry

Reply via email to