How do I convert Squeak code to GNU Smalltalk?
By Paolo Bonzini - Posted on February 6th, 2008
Tagged:
gst-convert can be used. It also supports rewrite rules to fix dialect incompatibilities automatically. You can write a script called, for example, gst-squeak like this one:
#! /bin/sh
#
# usage: gst-squeak SOURCE DEST
#
# Converts Squeak code to GNU Smalltalk
# Stymied by code like "foo-10" (notice no space around the
# minus), otherwise should work fine.
exec gst-convert -f squeak \
-r'MessageSend->DirectedMessage' \
-r'DateAndTime->DateTime' \
-r'(``@object ifNil: ``@arg ifNotNil: [ | `@t2 | `@.s2 ] )->
(``@object ifNil: ``@arg ifNotNil: [ :foo || `@t2 | `@.s2 ])' \
-r'(``@object ifNotNil: [ | `@t2 | `@.s2 ] ifNil: ``@arg )->
(``@object ifNotNil: [ :foo || `@t2 | `@.s2 ] ifNil: ``@arg)' \
-r'(``@object ifNotNil: [ | `@t2 | `@.s2 ] )->
(``@object ifNotNil: [ :foo || `@t2 | `@.s2 ])' \
-r'(``@object ifNil: ``@arg1 ifNotNilDo: ``@arg2 )->
(``@object ifNil: ``@arg1 ifNotNil: ``@arg2)' \
-r'(``@object ifNotNilDo: ``@arg2 ifNil: ``@arg1 )->
(``@object ifNotNil: ``@arg2 ifNil: ``@arg1)' \
-r'(``@object ifNotNilDo: ``@arg2 )->
(``@object ifNotNil: ``@arg2)' \
-r'(``@object doIfNotNil: ``@arg2 )->
(``@object ifNotNil: ``@arg2)' \
-r'(``@object newFrom: ``@arg2 )->
(``@object from: ``@arg2)' \
-r'(Dictionary withAll: ``@arg2 )->
(Dictionary from: ``@arg2)' \
"$@"