[Pharo-users] Help me make sense of this (AST manipulation)

Victor RENE victor-rene.dev at outlook.com
Tue May 3 07:58:01 EDT 2016


| f g h |
f := '[ :a | ^a + 1 ].'. " Message pattern expected "
g := '| b |'. " '|' expected "
h := '| b ||'. " Success?!? "
OpalCompiler compile: f.
OpalCompiler compile: g.
OpalCompiler compile: h.

Basically I went from writing a function to clean up StringMorphs on the World...
 
cleanupStringMorph
  "Clean up string morph in world."
  | x y |
  x := World submorphs.
  y := [ x select: [ :each | (each isMemberOf: StringMorph) ] ].
  y value do: [ :each | each delete ].
  Smalltalk garbageCollect.
 
...to wondering how to generalize the idea (pass the class as an argument)...
...but that would be too easy, so why not manipulate the AST programatically...
I read https://marcusdenker.de/publications/Bera13a-OpalIWST.pdf but the compiler
thinks I am a fool :-(
 
My guess is I need to know what are the method calls from text to AST to bytecode.
Any idea?

Victor RENESoftware engineer,Game designer, Writer
Blog: http://victor-rene.comProjects: http://logiqub.com
tel: +33 6 26 83 61 76email: victor-rene at outlook.com  		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pharo.org/pipermail/pharo-users_lists.pharo.org/attachments/20160503/5cd0c4aa/attachment.html>


More information about the Pharo-users mailing list