What is FalconJS?

This week Adobe announced plans for donating Flex SDK and BlazeDS to the Apache Software Foundation. The fine print of that statement mentions two projects, Falcon and FalconJS:

  • Falcon, the next-generation MXML and ActionScript compiler that is currently under development (this will be contributed when complete in 2012)
  • Falcon JS, an experimental cross-compiler from MXML and ActionScript to HTML and JavaScript.

You’ll find a few details about FalconJS towards the end of Adobe’s statement:

Q: Will Adobe provide migration tools to enable existing Flex applications to be converted to HTML/JavaScript?

We have undertaken some experimental work in this area, but remain unsure as to the viability of fully translating Flex-based content to HTML.

The Falcon JS cross-compiler, referenced above, represents this early work and intent to contribute this to the open source project.

So what is FalconJS? Is it any good? When will FalconJS become available?

Those are probably the questions that many Flex developers would love to have answered. Unfortunately, I can only begin to answer the first question (as the developer who came up with and implemented FalconJS).

FalconJS is an ActionScript to JavaScript cross-compiler based on Falcon, Adobe’s next generation, multi-threaded ActionScript compiler. From a distance, Falcon’s architecture looks pretty much like any other compiler architecture: a language front-end parses source code and creates an abstract syntax tree (AST), which gets reduced to machine code by a code generating backend. In Falcon’s case the language front-end parses ActionScript and the backend generates byte code that can be interpreted by an ActionScript Virtual Machine (AVM2) like the Flash Player. We call that byte code “abc”, which is the abbreviation of “Action Block Code” (and not “ActionScript Byte Code” like many people think). Most people are probably more familiar with SWF and SWC, which are just different package formats for abc byte code.

FalconJS simply replaces Falcon’s abc generating backend with its own JavaScript generating backend.
That’s my short description of FalconJS.

 

UPDATE (12/21/2011)

Adobe hosted a Flex Community Summit in San Francisco early December this year. The recordings are now available at Adobe TV and there is a segment about Falcon and FalconJS that I recommend watching:

Open Discussion about Falcon and FalconJS
http://tv.adobe.com/watch/flex-community-summit-december-2011/open-discussion-about-falcon-and-falconjs

Peter Flynn, who is with Adobe’s Flex team, did a great job explaining FalconJS’s architecture and its current limitations in regards to cross-compiling Flex applications. It might be worth pointing out that the recorded discussion refers to one of many specific use cases of FalconJS. Peter worked on a research project that investigated whether FalconJS could be used for cross-compiling Flex projects to JavaScript.

 

UPDATE (3/1/2012)

Adobe is in the process of donating Falcon and FalconJS to the Apache Foundation as part of the Apache Flex project.  If you are interested in the progress of those and other Flex related projects please subscribe to their developer mailing list.

 

UPDATE (12/10/2012)

Just a quick update on FalconJS and the Apache Flex incubator project:

On 11/23/2012 Alex Harui reported that FalconJS has landed in Apache’s source depot.

The source code is under trunk/compiler.js. There is also the asjs branch, which seems to explore runtime implementations.