Smalltalk code generation

Mariano Montone mariano_montone at yahoo.com.ar
Sat Oct 8 03:47:42 UTC 2005


Hi Alexandre, sorry for not answering before, I hadn't noticed the message.

The problem is that I have a code generation visitor traversing the AST. 
I need to generate different parts of the method from different methods 
of the visitor. I don't see how your approach may fit, that's why I need 
to implement it this way.

Thank you, Marian

Alexandre Bergel wrote:
> Hi Mariano!
>
>> cb := self commandBuilder
>> m := cb methodNamed: #conditionMethod withFormalArgs: #() comment: 
>> 'Condition method'.
>> m send: #ifTrue:ifFalse: to: (cb send: #isNil to: cb nil) with: (cb 
>> block: [:blk | blk return: (cb literal:'true')])
>>                                                                       
>>         with: (cb block: [:blk | blk return: (cb literal: 'false')]).
>
> I was wondering in which case do you _really_ need such an approach?
>
> Why not something like to be evaluated in a workspace:
>
> Parser new parse: 'conditionMethod
>   "Condition method"
>    nil isNil ifTrue:[^true] ifFalse:[^false]' class: nil class
>
> Cheers,
> Alexandre
> --_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
> Alexandre Bergel  http://www.iam.unibe.ch/~bergel
> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>
>
>
>
>


-- 
Dios concédeme la

Serenidad para aceptar
las cosas que no
puedo cambiar...

Valor para cambiar
aquellas que puedo y

Sabiduría para reconocer
la diferencia...

T. Morton


	

	
		
___________________________________________________________ 
1GB gratis, Antivirus y Antispam 
Correo Yahoo!, el mejor correo web del mundo 
http://correo.yahoo.com.ar 




More information about the Squeak-dev mailing list