Skip to content
geekrelief edited this page Sep 13, 2010 · 20 revisions

as3tohaxe

An Actionscript 3 to haXe converter written in Haskell

It’s not a complete translator. But the idea is to remove a lot of tedium when converting source code.

Check out my blog for progress updates and more.

Translation Abilities

  • datatypes
  • function signatures
  • “as” casting to “cast()”, “is” testing to “Std.is()”
  • member variable initialization moved to constructor
  • get and set functions are renamed and properties created
  • for(;;) loops to for iterators and while loops
  • package declarations
  • constructor declarations
  • SWF metadata tag to hxml file, comments out other metadata tags

I’ve added a Mac OSX binary compiled with ghc 6.8.3 on Leopard to the repo.

Compiling

To compile the converter you’ll need a copy of ghc and parsec3 installed. I also use Data.Generics which is not Haskell 98. Check out SYB/Scrap Your Boilerplate for info.

Compile as3tohaxe.hs with ghc --make -XDeriveDataTypeable as3tohaxe.hs.
Then run as3tohaxe [dir | file].
The output will appear in the directory hx_output.

Clone this wiki locally