Hi Kilon, I think it’s better that you take a look at PetitParser (e.g. http://www.themoosebook.org/book/internals/petit-parser <http://www.themoosebook.org/book/internals/petit-parser> ) I have found PetitParser more user friendly than SmaCC.
> On Jan 28, 2015, at 14:53, kilon alios <kilon.al...@gmail.com> wrote: > > Ok I have read a few times of the tutorial of Smacc in here > http://www.refactoryworkers.com/SmaCC/ASTs.html > <http://www.refactoryworkers.com/SmaCC/ASTs.html> > > and I am also following the help tool documentation inside pharo for SmaCC > and I have to say I am very confused. Please bare with me because I am > extremely noob when it comes to parsing, this is my first effort. > > Now the way I understand it so far, is that SmaCC uses a syntax similar to > regex expressions to define parsers and scanners. Scanners evaluate a string > to see that it contains a valid form and parser divide to parts named as > "tokens" and help in the creating of ASTs which are basically hierarchy tree > containing the syntax elements of a language. > > Now in order to make SmaCC work I need to use the SmaCC tool that comes with > pharo . The smacc tool takes two inputs a scanner and a parser class. Does > that mean I need to create that parser and scanner class ? I thought since I > define the syntax that those things would be generated by the tool. > > What I need to define exactly ? > > Why when I select the PythonScanner2 and PythonParser2 and click then Compile > LR it gives a MNU receiver of method is nil ? > > I am using latest Pharo 4 image. > > My goal is to parse python types to similar pharo objects. I get those python > types as strings and my main focus in lists, dictionaries and tuples . The > tricky part is that one can contain the other inside in every imagined way. > > The way I understand it I will need something called "transformations" to > convert those python types to OrderedCollections, Arrays etc and anything > would make more sense for a pharo coder. > > Additionally what is the meaning of the vertibal bar ? --> | > eg. > | Number > > Are there any other tutorials that can help a beginner like me to understand > these concepts ? > > I am not looking for someone to give me the solution to the plate, I would > love to learn and understand parsing because I am very interested into making > Pharo easy to mix with Python code and allow Pharo to use Python libraries > without the user having to learn or code Python :) > > As you may imagine this is a crucial ingredient for my project Ephestos which > tries to use Pharo to script Blender by either replacing or cooperating with > blender python. So learning a good way to parse pharo code to python code and > vice versa is extremely important for me. ---> Save our in-boxes! http://emailcharter.org <--- Johan Fabry - http://pleiad.cl/~jfabry PLEIAD lab - Computer Science Department (DCC) - University of Chile