About your *pending question*, you should read the very basics of smalltalk
before trying to understand its abstrations. Just to give you a hint (I
will use the Point example):


 (Point>>#x) "==> (Point>>#x "a CompiledMethod(880017408)")"

#aSymbol is just a singletone version of the string "aSymbol"; In what to
classes concerns it is used as a unique identifier in the method
dictionary. The rest is just syntax ">>" is the selector(s) (method(s))
 accessor, it will retrieve the keyed selector (in this case #x which again
is unique in the class) value, which is a CompiledMethod(atSomeAddress).

Now you can also get the contents  as a string if you want to parse it
yourself (compare to (Point>>#x) parseTree ):

(Point>>#x) definition "==> 'x
"Answer the x coordinate."
^x'"
Which is nothing more than the contents of the selector #x. I suggest, if
you want to get a "personalized" version of the parse tree, to try
PetitParser, there are many examples and even a Smalltalk80 parser in
there.

Hope this helps,


Jesus


2013/1/26 mircea <[email protected]>

> I will reply for each. Detailing my thought pattern. I know all the "rules
> and conventions" of smalltalk but i "can't play" very well.
>
> At first
> (Point>>#x) parseTree explore
> just looks weird.
>
> Then things start to settle. () Paranthesis means i don't actually have to
> care what is in there, conclusion is whatever happens the product of ()
> will be an object. I'm actually scared of >>, since i don't know what it
> does… i've seen it in old code snippets of class definitions.
>
> parseTree seems to be a method, and so does explore.
>
> *Going on… it seems to be a chain of unary messages.*
>
> Based on first trial conclusion it might be a statement even though the
> "." at the end is missing.
> I paste in the Workspace and right click 'Do It' on the whole thing.
>
> A window opens with lots of information in it. I can't make sense of it
> since i have no idea what i just did.
>
> *I need more information on what i just did.*
>
> Restart from the beginning.
>
> "Point" might be a point like in a cardinal system… x is there so i might
> be right.
> I replace x with y and 'Do It' again… another window pop open… seems to be
> quite similar to the first one only it has y in it instead of x.
> I continue the assumption and replace y with z.
> I get a KeyNotFound:, i don't understand this but it's similar to
> MessageNotUnderstood:. Since success would have meant i would get a similar
> window as in the x y case, getting a different window means the test failed.
>
> *I can only use x and y in the statement as it is now.*
>
> Point might be a class, i search for it… it seems to have instance
> variable names by that name. I add z to its list of instance variable
> names, save, replace it in the command… error. Assumption was incorrect. I
> look at the Point class again notice it also has accessor methods by that
> name, just x and y … there is no z. Agrees with the failure of earlier
> experiment, i might be on the right track.
> I choose another method of Point. Execute the command again… get the
> "success" window with lots of information on it.
> I choose another class and one of its methods, execute the command
> again… get the "success" windows with lots of information on it.
>
> *Conclusion… I can put any class name and choose any method it has and
> the command will pop up information about if. I don't understand the
> information from the pop up.*
> *
> *
> Restart from the beginning.
>
> I search for parseTree in the browser and there seems to be a lot of
> implementors of that method.
> I search for explore in the browser and Object seems to implement it.
> I 'Inspect It' on just the (Point>>#x) part and it seems to be producing a
> CompiledMethod object.
>
> Based on assumption from the beginning whatever happens between () is an
> object this object then responds to parseTree.
> I 'Inspect It' on just (Point>>#x) parseTree and get an RBMethodNode
> object. Seems the parseTree gets CompiledMethod as input and outputs this
> different kind of object called RBMethodNode.
>
> Adding explore, based on the fact that explore is a method of object,
> seems to be just a generic printout of this entire object.
>
> The end. Time elapsed, a little over 3 min. Took longer to write the email.
>
> *Pending questions:*
>
> What exactly does >> do here?
> I know # is followed by a string literal normally in '' but since there
> are no spaces just the characters will do.
>
>
>
>
>
>
>
>
>
> Pe 26.01.2013, la 13:41, Stéphane Ducasse [via Smalltalk] <[hidden 
> email]<http://user/SendEmail.jtp?type=node&node=4665574&i=0>>
> a scris:
>
> > It's like being a two-eyed man in a dark room with no flashlight. Your
> eyes are there, but without the flashlight there might as well be no room.
>
> >
> > Without previous knowledge of how this AST is implemented my best bet is
> do the "architectural plan" example i gave Dale H.
>
> (Point>>#x) parseTree explore
> will show you the tree then you can navigate in it.
>
>
>
> ------------------------------
> View this message in context: Re: How do i list the execution order of
> statements inside a 
> method?<http://forum.world.st/How-do-i-list-the-execution-order-of-statements-inside-a-method-tp4665303p4665574.html>
> Sent from the Pharo Smalltalk Users mailing list 
> archive<http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html>at 
> Nabble.com.
>

Reply via email to