Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

Falcon is a new compiler for Flex

...

that is under development. It will eventually replace the legacy compiler that has been part of the Flex SDK.

Current Status

Falcon has completed a legal review at Adobe and is awaiting signature by an Adobe VP, after which it will be donated to Apache.donated the source code to the Falcon compiler as revision 1383121 on September 10, 2012. It currently lives at flex/falcon/trunk. A development branch at {flex/falcon/branches/develop}} will follow after the build scripts have been tested and debugged.

The ActionScript side of Falcon is near-shippable quality and was the basis for Flash Builder 4.7 Preview 1. The rest of Falcon (MXML, CSS, FXG, PROPERTIES) is pre-alpha quality and not ready for production use. NeverthelessThe ActionScript side of Falcon is shipping quality and is the basis for Flash Builder 4.7. The rest of Falcon (MXML, CSS, FXG, PROPERTIES) is pre-alpha quality and not ready for production use. However, Falcon already supports enough of MXML to compile a correctly-running version of Checkinapp, the test app that is part of the SDK. THe . (Exception: Checkinapp uses one Repeater tag, which is not yet implemented.) The main areas where Falcon needs polish more work are databinding, states, MXML-specific error reporting, and ASDoc generation.

After donation, Gordon Smith of Adobe, who has worked on Falcon from the beginning of the Falcon project, is on loan to Apache Flex for one day a week to improve Falcon's MXML support, with the goal of making it a suitable replacement for the legacy compiler. He will provide advice to Apache developers contributing to Falcon. Alex Harui of Adobe has become familiar with MXML code generation in Falcon and can offer advice in that area.

Everyone can contribute to FalconEveryone can contribute to Falcon's development by using it to compile their Flex applications and reporting any bugs you find in Jira. Reducing a bug to a simple test case will make it infinitely more likely to be fixed.

Initial The following initial development efforts are planned:

  • Run the source code for all Apache Flex SWCs through Falcon to see if it reports spurious problems are reported.
  • Update the source code as necessary, given the fact that Falcon is somewhat stricter than the legacy compiler, so we will need to update the source code in a few places for Falcon. It should be possible to make both compilers happy.
  • Get various test apps besides Checkinapp compiling, linking against Falcon-compiled SWCs, and running correctly.
  • Get Mustella tests compiling with Falcon and passing.
  • Fix bugs that the Apache Flex community prioritizes.

Falcon's Original Goals

Falcon had the following goals when the project was started. Compared with the legacy compiler,

  • It should compile faster Reduced compilation time for both full and incremental compiles, especially for multi-project workspaces.
  • Reduced It should require less memory consumption, especially for multi-project workspaces.
  • Usefulness It should be useful as a code-intelligence engine and incremental compiler for an integrated development environment; , and not just as a command-line compiler.
  • Modular It should have a design that is easy to understand and to evolve.
  • Generation of beter It should generate better bytecode for better improved runtime performance.

Source Code

The Falcon trunk will soon be 'develop' branch is now available in Apache's Subversion GIT repository at https://svngit-wip-us.apache.org/repos/asf/incubator/flex/falcon/trunkImage Removed-falcon.git. You can download it with any Subversion GIT client.

Building Falcon

Binary Distributions

No binary distributions are available. Perhaps someone will volunteer to set up automated builds and a build download page?

Setup for Falcon

Falcon is written in Falcon is written in Java 1.6. Its build scripts use Ant 1.7.1. Eclipse projects for development use Eclipse 4.2 (Juno).

Information about Ant targets will be available by the time of donation.

All the compiled Java classes that comprise Falcon are packaged as falcon.jar. It is generated at generated/dist/sdk/lib. Other JAR files such as falcon-mxmlc.jar and falcon-compc.jar are codeless launcher JARs which serve only to run a particular entry point within Falcon. Launchers such as the shell script mxmlc or the batch file mxmlc.bat simply run these launch JARs from the command line.

...

You must obtain JFlex 1.4.3 as a prerequisite and set the environment variable JFLEX_JAR to point to JFlex.jar. You can obtain JFlex here.

Building Falcon

The top-level Ant script currently has the following targets:

Target

Purpose

javadoc

Builds Falcon's Javadoc at generated/javadoc.

eclipse

Prepares or updates the project for use in Eclipse. This takes care of generating the Java code for the lexers, parsers, and BURMs.

main (default)

Produces an SDK at generated/dist/sdk containing both Falcon and the legacy compiler.

clean

Cleans the build output but leaves any downloaded JARs.

wipe

Wipes out everything that didn't come from GIT.

The main, eclipse, or javadoc target will do a one-time download of five third party JARs:

  • lib/antlr.jar
  • lib/commons-cli.jar
  • lib/commons-io.jar
  • lib/guava.jar
  • lib/lzma-sdk.jar

Occasionally one of these downloads hangs. Just interrupt Ant and try again. These JARs will remain in the lib directory until you do a wipe.

If you do ant -q main (where the -q switch means "quiet" and turns off a lot of noisy output), the output the first time should look like this:

No Format

$ ant -q
    [echo] JFLEX_JAR is d:/jflex-1.4.3/jflex/lib/JFlex.jar
    [echo] Obtaining lib/antlr.jar
    [echo] Obtaining lib/commons-cli.jar
    [echo] Obtaining lib/commons-io.jar
    [echo] Obtaining lib/guava.jar
    [echo] Obtaining lib/jburg.jar
    [echo] Obtaining lib/lzma.jar
    [echo] Building lib/lzma.jar
    [echo] Generating RawASTokenizer
    [echo] Generating RawASDocTokenizer
    [echo] Generating RawMXMLTokenizer
    [echo] Generating ASParser and ASTokenTypes
   [antlr] ANTLR Parser Generator   Version 2.7.7 (20060906)   1989-2005
    [echo] Generating MetadataParser and MetadataTokenTypes
   [antlr] ANTLR Parser Generator   Version 2.7.7 (20060906)   1989-2005
    [echo] Generating CSSLexer and CSSParser
    [echo] Generating CSSTree
    [echo] Generating CmcEmitter
    [echo] Generating CSSEmitter
    [echo] Compiling Java code
    [echo] Creating generated/dist/sdk/lib/compiler.jar
    [echo] Creating generated/dist/sdk/lib/falcon-asc.jar
    [echo] Creating generated/dist/sdk/lib/falcon-mxmlc.jar
    [echo] Creating generated/dist/sdk/lib/falcon-compc.jar
    [echo] Creating generated/dist/sdk/lib/falcon-optimizer.jar
    [echo] Creating generated/dist/sdk/lib/falcon-swfdump.jar
    [echo] Creating lib/aet.jar
    [echo] Creating generated/dist/sdk/lib/flexTasks.jar
    [echo] Copying Apache SDK
    [echo] Building support.swc
    [echo] compiler main completed on 09/14/2012 11:32:37 PM

BUILD SUCCESSFUL
Total time: 1 minute 16 seconds

From this you can see that the overall flow of the build is

  • Download the necessary third-party JAR files.
  • Generate Java-based lexer classes from JFlex .lex files, Java-based parser classes from ANTLR .g files, and Java-based BURM classes from JBurg .jbg files.
  • Compile the Java code (both the code that's in GIT and the lexers/parsers/BURMs that are generated by the previous step).
  • Create the JAR files that are the Falcon deliverables.
  • Create a SWC file that needs to be used when compiling Flex with Falcon (because Falcon generates different code for CSS than the old compiler).

All the compiled Java classes that comprise Falcon are packaged as compiler.jar, which is generated at generated/dist/sdk/lib. Other JAR files such as falcon-mxmlc.jar and falcon-compc.jar are codeless launcher JARs which serve only to run a particular entry point within Falcon. Launchers such as the shell script mxmlc or the batch file mxmlc.bat simply run these launch JARs from the command line.

Because Falcon requires a number of other files (such as flex-config.xml, framework.swc, etc.) to compile anything, the Falcon build script actually creates a small SDK in which everything is arranged so that tools like Falcon's mxmlc work the way they would if they were in an actual Apache Flex SDK. This "Falcon SDK" is built at generated/dist/sdk.

Committing to Falcon

Each commit to the trunk will be expected to:

  • Keep the Java warnings in the Eclipse project(s) at 0.
  • Keep the 'ant javadoc' warnings at 0.
  • Provide Javadoc for new non-private APIs.
  • Not change the public API surface (to ease possible re-integration into Flash Builder).
  • Pass whatever tests are part of ant tests, once we have some tests.

Using Falcon

On the Command Line

The bin folder inside generated/dist/sdk has the command-line launchers like mxmlc, so using Falcon is the same as you are used to. For example, if you have but this bin directory on your PATH and you have cd'd to you application directory, then you just do

No Format

mxmlc MyApp.mxml

directory, then you just do

No Format

mxmlc MyApp.mxml

The options to the Falcon version of mxmlc are basically the same as for the legacy compiler. Some options such as -keep are no longer supported. If you try use an unsupported options, a warning will let you know.

In an Ant Script

Like the legacy compiler, Falcon provides <mxmlc> and <compc> Ant tasks. They are implemented by the classes MXMLCTask and COMPCTask in the org.apache.flex.compiler.ant package. These classes are part of falcon.jar. To use these tasks in an Ant script, first do

No Format

<taskdef ???/>

The require that the Ant property FLEX_HOME be set to a Flex SDK directory so that config files and SWC files can be foundThe options to the Falcon version of mxmlc are basically the same as for the legacy compiler. Some options such as -keep are no longer supported. If you try use an unsupported options, a warning will let you know.

Inside Eclipse

The relevant entry points for a Debug Configuration are the MXMLC and COMPC classes in the comorg.adobeapache.flashflex.compiler.clients package.

Inside Flash Builder

There is no way to use Apache Falcon inside of Flash Builder, at least for now. Because Falcon is designed to be both a compiler and a code-intelligence engine, it has to be tightly integrated with Flash Builder; Flash Builder cannot load it from an SDK.

Testing Falcon

Test suites for Falcon Falcon's existing test suites are not yet ready for donation, because they are very large and require more extensive legal review. They will be donated laterwill be donated later.

As soon as possible after donation, a handful of tests will be developed to ensure that are still able to compile framework.swc and Checkinapp. These make poor unit tests but reasonable functional tests.

Javadoc

Falcon has reasonably extensive Javadoc, including a short overview and package-level documentation that provides a general orientation to various subsystems. The Javadoc is not currently available online. If we get an automated build for Falcon, we may start posting Javadoc.

To build itthe Javadoc, download the source code and do

...

in the compiler directory within Falcon's trunk. The generated HTML is inside generated/javadoc within Falcon's trunk. Open index.html in any browser and start by clicking on the Description link at the top to see the overview.

History

Spring 2010

Falcon began as a project at Adobe in the spring of 2010, in response to the Flex community's concerns about long compilation times with the legacy compiler. There were The project began with several months of discussions about improving the old compiler versus starting over with Falcon. The main reasons for starting over were:

1. *The compiler team at Adobe wanted a compiler that could do double-duty as the code-intelligence engine for Flash Builder, rather than being something completely separate that Flash Builder called just to create a SWF or SWC. This approach would avoid duplicate data structures and duplicate algorithms, and would enable live error highlighting based on accurate semantic analysis. The team ended up taking Flash Builder's code intelligence engine, improving it, and adding semantic analysis and code generation to it. The resulting Falcon compiler doesn't have dependencies on Flash Builder though... it's the other way around.

2. *The legacy compiler wasn't designed for compilation on multiple threads. The team wanted a compiler that was designed with concurrency in mind from the beginning, as a primary way to get better – and scalable – performance.

3. *There was an awkward relationship between the legacy asc (which essentially understands only how to compile a single .as file) and the legacy mxmlc (which layers on top multi-file compilation and support for .mxml, .css, .properties, and .fxg), based on their historical development by two separate teams at Adobe. The team wanted a single compiler, designed by a single team, that had a unified architecture, unified data structures, and multi-file / multi-language support from the bottom up.

Fall 2011

A In the fall of 2011, a strategic shift at Adobe resulted a refocus on ActionScript and a defocus on Flex and MXML. Flex was donated to Apache, with a promise to finish the ActionScript side of Falcon and donate it by the end of 2012. Non-ActionScript support was left intact, at pre-alpha quality.

Summer 2012

In the summer of 2012, Falcon was ready prepared for donation to Apache. By this point it has involved approximately 15 person-years of development effort.

The Future

It's up to us now! However, before striking out in radical new directions we should bring Falcon to the point where it can replace the legacy compiler.

Architecture

Falcon is designed from the beginning to support compiling multiple targets in multiple projects in a workspace, as exist in an IDE like Flash Builder. By contrast, the legacy asc was designed to compile a single AS file, and then the legacy mxmlc was built by another team on top of that.

...

Q: Where is the specification for ActionScript ByteCode (ABC)?

A: http://www.adobe.com/content/dam/Adobe/en/devnet/actionscript/articles/avm2overview.pdfImage Removed

Q: What is a semantic checker?

...

A: Falcon does constant propagation and inlining.

Aditional Information about Falcon and FalconJS

Open Discussion about Falcon and FalconJS
Adobe announces important changes to Flex SDK