Sunday, May 11, 2008

ActionScript Cross Compiler Theories

This post is a bit late coming, but I'm trying to be good and post once a week.

Last year after Adobe MAX 2007, I posted a bit on the preview of a C++ to ActionScript compiler. This year there has been a little more buzz buzz on the subject. I've been curious how this might be done and have a few theories:
  • Create a C++ parser/compiler to either produce Flash bytecodes or ActionScript. C++ is notoriously hard to parse so this would be quite a pain without something to get you started. There is a partial ANTLR grammar for C++ here.
  • Create a gcc backend to produce Flash bytecodes. All gcc languages compile to intermediate languages called GIMPLE and GENERIC. Target platforms "merely" translate this intermediate form to the target platform. See this link for more information. This path would be the most generic solution and allow any gcc language to be compiled to flash.
  • Leverage PyPy (a python VM generator and more) to create an ActionScript or Flash bytecode target. Of course this would only really help you use python unless you created a translator for C++, but flex-pypy is cool enough to mention.
Overall I think the gcc solution is the most likely and most powerful. I'm looking forward to the cross compiler and hope it will be included in Flex 4 as part of the broadening horizons theme.

No comments:

Post a Comment