[Pharo-users] SmaCC: First steps

2015-01-28 Thread kilon alios
Ok I have read a few times of the tutorial of Smacc in here 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, thi

Re: [Pharo-users] SmaCC: First steps

2015-01-28 Thread Johan Fabry
Hi Kilon, I think it’s better that you take a look at PetitParser (e.g. 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 wrote:

Re: [Pharo-users] SmaCC: First steps

2015-01-28 Thread Thierry Goubier
2015-01-28 14:53 GMT+01:00 kilon alios : > Ok I have read a few times of the tutorial of Smacc in here > 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 becaus

Re: [Pharo-users] SmaCC: First steps

2015-01-28 Thread kilon alios
Yes I am aware of PettitParser but the one thing that made me very interested into SmaCC is that it already supports Python syntax parsing , though I think is for Python 2 but if its 2.7 it wont be much issue for me that use Python 3.4 syntax. >From a first look it looks PettitParser easier to use

Re: [Pharo-users] SmaCC: First steps

2015-01-28 Thread kilon alios
"Ok. I made sure the help was up to date with the current SmaCC; the online tutorial may differ a bit (GUI, some of the class creation commands)." Yes I am not complaining about your effort. I am just new with parsing and everything looks alien to me :D I am mostly following your documentation in

Re: [Pharo-users] SmaCC: First steps

2015-01-30 Thread kilon alios
Ok so I tried to parse a very simple list like [ 67,12342,5 ] using Parse and explore , I can find these number by following this AST (for example 67) PyFileInputNode>>statements: -> 1: PySimpleStmNode>>stmts: -> 1: PyExprStmtNode>>tests: ->1: PyPowerNode>>atom: -> PyAtomNode>>list: -> 1: PyPowe

Re: [Pharo-users] SmaCC: First steps

2015-01-30 Thread Thierry Goubier
Hi kilon, The tests instance variable is linked to the python grammar: top level items in an expression are probably tests, and, through the grammar, tests can be just atoms. So the tests instance variable doesn't means it is testing anything :) Thierry Le 30 janv. 2015 09:23, "kilon alios" a é

Re: [Pharo-users] SmaCC: First steps

2015-01-30 Thread kilon alios
Ok thanks for the info, I am still however curious about these "tests" are just tests (which may or may not happen) that determine the AST, for example which node to use ? Or are they tests related to unit testing class PythonParserTests ? Also you said I need to use the visitor created by Python

Re: [Pharo-users] SmaCC: First steps

2015-01-30 Thread Thierry Goubier
2015-01-30 14:04 GMT+01:00 kilon alios : > Ok thanks for the info, I am still however curious about these "tests" are > just tests (which may or may not happen) that determine the AST, for > example which node to use ? > 'tests' is just there because, in the grammar, there is this at a certain po

Re: [Pharo-users] SmaCC: First steps

2015-01-30 Thread kilon alios
thank for your congratulations, because at times I fear I ask too obvious questions. I have to say I find this parsing very complex but very fascinating too :) Time to experiment with the visitor. On Fri, Jan 30, 2015 at 11:49 PM, Thierry Goubier wrote: > > > 2015-01-30 14:04 GMT+01:00 kilon ali

Re: [Pharo-users] SmaCC: First steps

2015-02-10 Thread kilon alios
Ok so after rereading the tutorial and testing again and again , I think I have finally managed to understand how SmaCC really works and I was succesful into converting simple python litsts to pharo arrays and ordered collections. The tricky part now is to apply this knowledge to complex python ty

Re: [Pharo-users] SmaCC: First steps

2015-02-11 Thread Thierry Goubier
Hi Kilon, 2015-02-11 8:24 GMT+01:00 kilon alios : > Ok so after rereading the tutorial and testing again and again , I think I > have finally managed to understand how SmaCC really works and I was > succesful into converting simple python litsts to pharo arrays and ordered > collections. > > The

Re: [Pharo-users] SmaCC: First steps

2015-02-11 Thread kilon alios
"What you see is that, with the {{}}, I create PyAtomNode instances for all productions, even if it isn't appropriate. Maybe this should be changed like that for lists : | {{List}} | listmaker 'list' {{List}}" Both approaches you described a) adding instance methods to PyAtomNode that

Re: [Pharo-users] SmaCC: First steps

2015-02-11 Thread Sebastian Heidbrink
Hi! Maybe you also want to have a look at http://www.squeaksource.com/openqwaq/ There is a part PyBridge included. MAybe you can take some of the Smalltalk Python Cmodel classes from there. Sebastian Am 10.02.2015 um 23:24 schrieb kilon alios: Ok so after rereading the tutorial and testing

Re: [Pharo-users] SmaCC: First steps

2015-02-11 Thread Thierry Goubier
2015-02-11 11:16 GMT+01:00 kilon alios : > "What you see is that, with the {{}}, I create PyAtomNode instances for > all productions, even if it isn't appropriate. Maybe this should be changed > like that for lists : > > | {{List}} > | listmaker 'list' {{List}}" > > Both approaches you

Re: [Pharo-users] SmaCC: First steps

2015-02-11 Thread kilon alios
Well I tried in the past to use openqwaq , but what I learned from the experience is that sometimes understanding others code can be even more time consuming than remaking it yourself. I spent like an afternoon trying to understand openqwaq before starting Ephestos from complete scratch. Suffice to

Re: [Pharo-users] SmaCC: First steps

2015-02-11 Thread kilon alios
"Yes, if you find that appropriate or if they share some implementation bits (I'm not sure of the latter, but it may help to organise stuff). What you do is, in the grammar, you add a %hierarchy directive, like that: %hierarchy Atom (List Dictionary); And, at AST generation, SmaCC will inherit as

Re: [Pharo-users] SmaCC: First steps

2015-02-12 Thread Trygve Reenskaug
The problem with reading class oriented code (C++, Java, C#, Ruby, ..., Smalltalk) is that the code does not reveal how the system will work at runtime (polymorphism). The essence of object orientation is that objects collaborate to achieve a goal. The DCI programming paradigm adds code for ho

Re: [Pharo-users] SmaCC: First steps

2015-02-21 Thread stepharo
yes and I would love to see that documented in the chapter :) Le 11/2/15 09:54, Thierry Goubier a écrit : implementing the ident/dedent tokens was the most interesting part in there.

Re: [Pharo-users] SmaCC: First steps

2015-03-01 Thread kilon alios
I have this grammar definition in the python parser file_input: {{}} | file_input {{}} | file_input stmt 'statement' {{}} ; So I would expect a) the class to be name Pyfile_inputNode , instead is named PyFileInputNode, why ? b) I would expect a "statement" instance variable in that c

Re: [Pharo-users] SmaCC: First steps

2015-03-01 Thread Thierry Goubier
Le 01/03/2015 09:13, kilon alios a écrit : I have this grammar definition in the python parser file_input: {{}} | file_input {{}} | file_input stmt 'statement' {{}} ; So I would expect a) the class to be name Pyfile_inputNode , instead is named PyFileInputNode, why ? The nam

Re: [Pharo-users] SmaCC: First steps

2015-03-01 Thread Thierry Goubier
Le 21/02/2015 17:36, stepharo a écrit : yes and I would love to see that documented in the chapter :) Need to make a part on pre-existing parsers in the SmaCC distribution: Smalltalk, C, Java, C#, Python. I've prepared two very limited examples for teaching purposes, illustrating: - symbol

Re: [Pharo-users] SmaCC: First steps

2015-03-03 Thread kilon alios
"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

Re: [Pharo-users] SmaCC: First steps

2015-03-03 Thread Thierry Goubier
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 be

Re: [Pharo-users] SmaCC: First steps

2015-03-03 Thread kilon alios
"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 a

Re: [Pharo-users] SmaCC: First steps

2015-03-03 Thread kilon alios
also forgot to add that now I am using gitfiletree and it has been a very smooth ride. Works great with Ubuntu and Macos and I tested it across computers. Thank you for your hard work. On Tue, Mar 3, 2015 at 9:42 PM, kilon alios wrote: > > "It's because it is on a particular parse you have a sin