At Adobe MAX 2008 San Francisco,
Alchemy was released. Alchemy was once known as FlaCC or Cassava and is a C/C++ to ActionScript compiler.
Alchemy works by translating C/C++ code to ActionScript through a LLVM compiler which instead of producing machine or bytecode produces ActionScript. The translated C/C++ code uses a big ActionScript ByteArray as the C/C++ heap and stack. The performance of alchemy is slow if you martial data from C/C++ code to ActionScript or back but faster (supposedly up to 10 times faster) than ActionScript code you write yourself for data intensive actions where everything operates in the C/C++ memory space - speed improvements over AS code are also due to LLVM doing code optimization which is missing from the normal AS compiler.
After downloading and setting up Alchemy, I started trying to port over a few C/C++ libraries. The following libraries have given me some trouble mainly with needing to adjust makefiles or the ./configure script: Angband, Nethack, guile, Python, Ruby, ARToolkitPlus, SDL, and Squeak. I haven't given up on them but I wasn't in the mood to do battle with Makefiles; I wanted to learn Alchemy.
My success came with compiling the scripting language
Lua 5.1.4 and embedding it into a Flex application. The following proof of concept can run a Lua script which returns one or more values and are shown in the
Lua Stack Panel. Lua can make the following calls into Flex:
- getTextAreaProperty(property_name) - Returns the given property of the text area in the lower left hand corner.
- setTextAreaProperty(property_name, value) - Sets the given property on the text area in the lower left hand corner (must accept string values).
- callTextAreaFunction(function_name[, param1, ..., paramN]) - Calls a function on the text area in the lower left hand corner (must accept string values).
- average(value1, ..., valueN) - Returns the average and sum of the given values.