The Flash version of Vista Smalltalk is based on transformation of Smalltalk grammar to an equivalent set of Lisp s-expressions which are then executed by the interpreter.
Here are a number of examples generated by the current Smalltalk parser:
Smalltalk Lisp 3 + 4 * 5 (* (+ 3 4) 5) 3 + (4 * 5) (+ 3 (* 4 5)) X := ‘hello world’ (setq X “hello world”) Transcript showcr: X (send Transcript ’showcr- X) [ :a :b | a * b ] (lambda (a b) (* a b)) [ :a :b | a * b ] value: 7 value:9 (funcall (lambda (a b) (* a b)) 7 9) 7 < ( 3 + 5) iftrue: [ 'less than 8' ] (cond ((< 7 (+ 3 5)) ((lambda nil “less than 8″))) (t))
The following special cases should be finished in the next couple of days:
- whileTrue:
- whileFalse:
- do:
- do:to:
- do:to:by:
- and:
- or:
Then I will begin integrating the Smalltalk interpreter with the class browser and the animation libraries.
This is cool stuff, I look forward to playing with it.
Dumb question but since ruby is so similar, can you do the same trick with converting ruby into s-expressions?
Comment by David — March 8, 2007 @ 11:21 pm
Hi,
Very nice transformations. What would an automatic translator look like?
What does the source for “send” look like?
What are your plans for where you are taking this?
All the best,
Peter
Comment by Peter William Lount — March 9, 2007 @ 6:06 am
David,
Yes, the same thing could be done for Ruby, Python, Basic, etc.
I will add more languages in the future.
Comment by pfisk — March 9, 2007 @ 3:05 pm
Peter,
1) this automatic translator (for Smalltalk) is written in ActionScript and uses a customized Lisp reader and list functions to build the s-expressions. Future versions will probably be written in Lisp.
2) “send” is built into the Lisp interpreter (written in ActionScript) and uses a Smalltalk-style method lookup and dispatch. At some future date, there will be an SDK for the source code.
3) Future plans:
3.1) finish Flash version (graphics, communications, etc)
3.2) synchronize Flash and .Net versions
3.3) integrate expert system component
3.4) single programming environment (Smalltalk, Lisp, AI) across Flash & .Net platforms
Comment by pfisk — March 9, 2007 @ 3:18 pm