Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

MXML: the Falcon compiler turns MXML AST into straight ABC instructions.

"I don't see why you would need to transform the MXML AST into yet another model. There are already two models for MXML and they should be sufficient.

The syntactic model produced from the MXML tokens is MXMLData. Like any XML DOM, it simply represents the nesting of the tags, their attributes, and the text inside, without attributing any meaning to anything.

The semantic model for MXML is the MXML AST, which has determined what every tag, attribute, and piece of text means. For example, it has understood that when you write <s:Button label="OK" color="red" click="doit()"/> you are creating an instance of spark.components.Button, setting the label property to "OK", setting the color style to 0xFF0000, and adding an event handler to handler the click event. The MXML tree captures every piece of semantic information that was in the MXML file."

"But if you prefer to turn MXML into JavaScirpt source code, it should be straightforward to do that. The MXMLClassDirectiveProcessor is a simple recursive descent through the MXML AST. The main complexity is that it can't simply generate a continuous stream of code in tree order. For example, an attribute value that is a databinding expression has to generate all sorts of extra stuff like Watcher instances in other places."

FalconJS

FalconJS is a project started by Alex Harui. It is currently the most
complete implementation and has (limited?) MXML parsing. The FalconJS
compiler will take an MXML and AS project and output a valid HTML/JS
application. FalconJS does depend on a custom AS framework (i.e. won't
work with the Flex SDK) and corresponding JS framework. This framework
goes by the name of FlexJS. Read more about it on the Wiki:

https://cwiki.apache.org/confluence/display/FLEX/Alex%27s+FlexJS+Prototype\

"I may be missing something, but I think the MXMLClassDirectiveProcessor is
walking the AST not some intermediate model.  What it does is a bit tricky
because it is trying to flatten the tree into the data array and use the
same APIs (of passing around Contexts).  I haven't looked at your walker
recently, but it might be simpler to implement in the walker/visitor
pattern."

...

https://cwiki.apache.org/confluence/display/FLEX/AS+to+JS+-the%27goog%27+Way\

FalconJx future: once we have AS (and hopefully MXML, at some point)
translating into JS and have functional tests in place, the challenge
will become to come up with both AS and JS framework to actually allow
for application development. I'm silly enough to still cling to the
idea that we'll be able to use (most of) the Flex SDK and create a
compatible JS library... but I'm sure others will declare me insane
for just dreaming about that :-)

...