« The Bind-Case Macro AS3 Lisp Source »

Lisp Interpreter in AS3

So back when Adobe released the Flash 9 Pre-Alpha I took the opportunity to learn AS3 by indulging in one of my favorite pastimes, writing a Lisp interpreter. And what’s even more odd than coding a Lisp interpreter for enjoyment is that when I had it to a point where it was somewhat working, I came up with an actual use for it. Anyway, going into the actual use I found for it is another story that has to do with the interesting bonus you get when you can run the same code on the server as you can on the client. So here’s the link and here’s the list of stuff that seems to work. Update: I posted the source for this, check out the entry here.

  • mapcar
  • apply,funcall
  • every
  • reduce
  • find-if
  • remove-if,remove-if-not
  • prog1,prog2,progn
  • push
  • pop
  • incf
  • decf
  • while
  • until
  • when
  • unless
  • with-output-to-string
  • multiple-value-list
  • multiple-value-call
  • multiple-value-prog1
  • multiple-value-bind
  • nth-value
  • dotimes
  • dolist
  • cons
  • rplaca,rplacd
  • list
  • member
  • reverse
  • append
  • list-length
  • car,cdr
  • last
  • nth,nthcdr
  • first,second……tenth
  • caar….cddddr
  • +,-,*,/
  • expt
  • mod
  • rem
  • random
  • 1+,1-
  • floor
  • ceiling
  • truncate
  • round
  • print
  • princ
  • format
  • null
  • zerop
  • plusp,minusp
  • oddp,evenp
  • listp,atom
  • symbolp
  • numberp
  • keywordp
  • stringp
  • quote
  • backquote,unquote,unlist
  • setq,set
  • setf(car,cdr,symbol-value)
  • defvar,defparameter
  • if,cond
  • and,or
  • eval
  • defun,defmacro
  • lambda
  • let,let*
  • do,do*
  • destructuring-bind
  • macroexpand
  • macroexpand-1
  • intern
  • symbol-name
  • symbol-value
  • symbol-function
  • macro-function
  • gensym
  • values
  • values-list
  • =,/=,eq,equal
  • <,<=
  • >,>=
  • not

Comments

  1. edu | August 22nd, 2007 | 9:23 am

    Wow, it’s great!

    Would you make the code available?

  2. Willyh | August 22nd, 2007 | 9:53 am

    Can we see the code?

  3. Andrew | August 22nd, 2007 | 9:55 am

    Very nice. Are you going to release the code? I’m learning AS3 (coming from a more functional background) and I’d love to see it.

  4. Joel | August 22nd, 2007 | 9:58 am

    Glad to see you posted this online. Great job.

    I’ll look forward to reading more from you.

  5. admin | August 22nd, 2007 | 10:10 am

    I’ll post the code soon, please keep in mind that I was still learning at the time.

    n

  6. Viljo | August 22nd, 2007 | 1:18 pm

    Man, this is just wicked cool, keep up the good work!

  7. Brian Adkins | August 22nd, 2007 | 1:27 pm

    Well done. No need to apologize about code quality; it’s quite an accomplishment.

    I’d say your new blog is off to a great start :)

  8. [ draw.logic ] Flash9 AS3 Lisp Interpreter « | August 23rd, 2007 | 1:49 am

    […] drawk Well, one thing is for sure AS3 is inspiring programmers and Solve et Coagula made a Lisp interpreter for Flash9/AS3. Silverlight has some programming advantages over flash due to the fact that many languages can be […]

  9. Cliff | August 23rd, 2007 | 8:15 am

    You are my hero.

  10. gustav | January 4th, 2008 | 10:16 am

    This is wicked cool. Hey, I’d like to try this using flex_sdk_2/bin/mxmlc. Question, Console extends fl.core.UIComponent which is not part of Flex. Does it have to be UIComponent or Sprite will do? (It’s hard to read Lisp.fla file ;)

  11. admin | January 4th, 2008 | 10:55 am

    @Gustav: I’ve have had it working in Flex before with no issues, although I was building it with FlexBuilder. I did notice that in the code Console extends mx.core.UIComponent not fl.core.UIComponent.

  12. gustav | January 7th, 2008 | 3:50 pm

    FlexBuilder must perform some extra magic I don’t know about. Tried to extend mx.core.UIComponent with implementing createChildren(), commitProperties(), measure(), and updateDisplayList(), etc. It compiles but not functional. Obviously, I don’t have the complete know-how.

    Ended up using 2 mx.controls.TextArea, one for input and another for output. REPL does the evaluation fine. (I think this is how Jatha does its GUI.)

    Back to reading Flex API…to implement your elegant Terminal emulation part. Thanks again for the code. Enjoying it very much.

  13. Interpretador Lisp AS3 « Colabora | December 27th, 2008 | 9:41 am

    […] O projeto Colabora pretende incorporar um interpretador de autolisp em sua interface para desenhos. Existe um interpretador Lisp em Actionscript3 que pode ser usado na interface Flash: http://www.solve-et-coagula.com/?p=8 […]

Post a comment