You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flex.apache.org by Michael Schmalle <te...@gmail.com> on 2015/06/08 23:10:57 UTC

[FalconJX] Round tripped vanillar compiler with JS.swc and FlexJS emitter.

Hi,

Well for me, this is like walking on the moon. I knew that this little
tangent I was going down was not going to be real until the following
things happened;

1. I wrote a parser/translator for javascript external API.
2. I wrote a resolver that could understand all the javascript to create a
hierarchy which would then produce valid AS to compile.
3. Compile this translated JS -> AS into a swc that Falcon would compile
AND Falcon could load for projects using JS.swc.
4. Write a simple Hello FalconJX app that used the built JS.swc and a
Main.as file that was used with the MXMLJS compiler, using library and
source paths.
5. Cross compile that compilation result into JS using the FlexJS emitter.

Well, for myself this round trip is one of my better accomplishments in
regards to patients. So without further ado, I present the first NO
PLAYERGLOBAL production of a strictly Javascript created API in
ActionScript!

IntellIJ Application setup with JS.swc created by Falcon (no
playerglobal.swc)

http://snag.gy/7mOG1.jpg

So what actually happened, is I started with Rhino and QDoc, then I went
down the rabbit hols and started studying the Closure compiler source code,
WOW it used the same AST as Rhino but it supports ES6.

So over the weekend I took the time to get everything just sing the closure
compiler parser and compiler! I am using the JAVA API not the command line,
I wrote 2 custom compiler passes, the first gets all the Types, the second
get all the members using AST.

This was important because I need all the types existing before members are
added to my reference model.

Anyway, Rhino and QDox deps are axed and I am just using the GCC code base
right now.

The bright spot is all the external js files we digest cet compiled with
GCC and we get warnings or errors, this could be good for external libs to
make sure everything is working.

I have more I need to write but I am fried. :) This last screen shot is my
roundtrip test if you are wondering what I did to test the full "tool
chain".

http://snag.gy/JMppY.jpg


Mike



------------------------------------------------------
ActionScript
------------------------------------------------------

package {

public class Main {

    public function Main() {
        var button:Element = document.createElement("button", null);
        button.textContent = "Say Hello";
        button.onclick = function ():void {
            button.textContent = "Say Hello FalconJX!";
        };
        document.body.appendChild(button);
    }
}
}

------------------------------------------------------
JavaScript production
------------------------------------------------------

/**
 * Main
 *
 * @fileoverview
 *
 * @suppress {checkTypes}
 */

goog.provide('Main');



/**
 * @constructor
 */
Main = function() {
  var self = this;
  var /** @type {Element} */ button = document.createElement("button",
null);
  button.textContent = "Say Hello";
  button.onclick = function() {
    button.textContent = "Say Hello FalconJX!";
  };
  document.body.appendChild(button);
};


/**
 * Metadata
 *
 * @type {Object.<string, Array.<Object>>}
 */
Main.prototype.FLEXJS_CLASS_INFO = { names: [{ name: 'Main', qName:
'Main'}] };

Re: [FalconJX] Round tripped vanillar compiler with JS.swc and FlexJS emitter.

Posted by Alex Harui <ah...@adobe.com>.
Amazing again!

On 6/8/15, 3:43 PM, "Josh Tynjala" <jo...@gmail.com> wrote:

>Nice! You're rockin' it.
>
>- Josh
>
>On Mon, Jun 8, 2015 at 2:10 PM, Michael Schmalle
><te...@gmail.com>
>wrote:
>
>> Hi,
>>
>> Well for me, this is like walking on the moon. I knew that this little
>> tangent I was going down was not going to be real until the following
>> things happened;
>>
>> 1. I wrote a parser/translator for javascript external API.
>> 2. I wrote a resolver that could understand all the javascript to
>>create a
>> hierarchy which would then produce valid AS to compile.
>> 3. Compile this translated JS -> AS into a swc that Falcon would compile
>> AND Falcon could load for projects using JS.swc.
>> 4. Write a simple Hello FalconJX app that used the built JS.swc and a
>> Main.as file that was used with the MXMLJS compiler, using library and
>> source paths.
>> 5. Cross compile that compilation result into JS using the FlexJS
>>emitter.
>>
>> Well, for myself this round trip is one of my better accomplishments in
>> regards to patients. So without further ado, I present the first NO
>> PLAYERGLOBAL production of a strictly Javascript created API in
>> ActionScript!
>>
>> IntellIJ Application setup with JS.swc created by Falcon (no
>> playerglobal.swc)
>>
>> http://snag.gy/7mOG1.jpg
>>
>> So what actually happened, is I started with Rhino and QDoc, then I went
>> down the rabbit hols and started studying the Closure compiler source
>>code,
>> WOW it used the same AST as Rhino but it supports ES6.
>>
>> So over the weekend I took the time to get everything just sing the
>>closure
>> compiler parser and compiler! I am using the JAVA API not the command
>>line,
>> I wrote 2 custom compiler passes, the first gets all the Types, the
>>second
>> get all the members using AST.
>>
>> This was important because I need all the types existing before members
>>are
>> added to my reference model.
>>
>> Anyway, Rhino and QDox deps are axed and I am just using the GCC code
>>base
>> right now.
>>
>> The bright spot is all the external js files we digest cet compiled with
>> GCC and we get warnings or errors, this could be good for external libs
>>to
>> make sure everything is working.
>>
>> I have more I need to write but I am fried. :) This last screen shot is
>>my
>> roundtrip test if you are wondering what I did to test the full "tool
>> chain".
>>
>> http://snag.gy/JMppY.jpg
>>
>>
>> Mike
>>
>>
>>
>> ------------------------------------------------------
>> ActionScript
>> ------------------------------------------------------
>>
>> package {
>>
>> public class Main {
>>
>>     public function Main() {
>>         var button:Element = document.createElement("button", null);
>>         button.textContent = "Say Hello";
>>         button.onclick = function ():void {
>>             button.textContent = "Say Hello FalconJX!";
>>         };
>>         document.body.appendChild(button);
>>     }
>> }
>> }
>>
>> ------------------------------------------------------
>> JavaScript production
>> ------------------------------------------------------
>>
>> /**
>>  * Main
>>  *
>>  * @fileoverview
>>  *
>>  * @suppress {checkTypes}
>>  */
>>
>> goog.provide('Main');
>>
>>
>>
>> /**
>>  * @constructor
>>  */
>> Main = function() {
>>   var self = this;
>>   var /** @type {Element} */ button = document.createElement("button",
>> null);
>>   button.textContent = "Say Hello";
>>   button.onclick = function() {
>>     button.textContent = "Say Hello FalconJX!";
>>   };
>>   document.body.appendChild(button);
>> };
>>
>>
>> /**
>>  * Metadata
>>  *
>>  * @type {Object.<string, Array.<Object>>}
>>  */
>> Main.prototype.FLEXJS_CLASS_INFO = { names: [{ name: 'Main', qName:
>> 'Main'}] };
>>


Re: [FalconJX] Round tripped vanillar compiler with JS.swc and FlexJS emitter.

Posted by Josh Tynjala <jo...@gmail.com>.
Nice! You're rockin' it.

- Josh

On Mon, Jun 8, 2015 at 2:10 PM, Michael Schmalle <te...@gmail.com>
wrote:

> Hi,
>
> Well for me, this is like walking on the moon. I knew that this little
> tangent I was going down was not going to be real until the following
> things happened;
>
> 1. I wrote a parser/translator for javascript external API.
> 2. I wrote a resolver that could understand all the javascript to create a
> hierarchy which would then produce valid AS to compile.
> 3. Compile this translated JS -> AS into a swc that Falcon would compile
> AND Falcon could load for projects using JS.swc.
> 4. Write a simple Hello FalconJX app that used the built JS.swc and a
> Main.as file that was used with the MXMLJS compiler, using library and
> source paths.
> 5. Cross compile that compilation result into JS using the FlexJS emitter.
>
> Well, for myself this round trip is one of my better accomplishments in
> regards to patients. So without further ado, I present the first NO
> PLAYERGLOBAL production of a strictly Javascript created API in
> ActionScript!
>
> IntellIJ Application setup with JS.swc created by Falcon (no
> playerglobal.swc)
>
> http://snag.gy/7mOG1.jpg
>
> So what actually happened, is I started with Rhino and QDoc, then I went
> down the rabbit hols and started studying the Closure compiler source code,
> WOW it used the same AST as Rhino but it supports ES6.
>
> So over the weekend I took the time to get everything just sing the closure
> compiler parser and compiler! I am using the JAVA API not the command line,
> I wrote 2 custom compiler passes, the first gets all the Types, the second
> get all the members using AST.
>
> This was important because I need all the types existing before members are
> added to my reference model.
>
> Anyway, Rhino and QDox deps are axed and I am just using the GCC code base
> right now.
>
> The bright spot is all the external js files we digest cet compiled with
> GCC and we get warnings or errors, this could be good for external libs to
> make sure everything is working.
>
> I have more I need to write but I am fried. :) This last screen shot is my
> roundtrip test if you are wondering what I did to test the full "tool
> chain".
>
> http://snag.gy/JMppY.jpg
>
>
> Mike
>
>
>
> ------------------------------------------------------
> ActionScript
> ------------------------------------------------------
>
> package {
>
> public class Main {
>
>     public function Main() {
>         var button:Element = document.createElement("button", null);
>         button.textContent = "Say Hello";
>         button.onclick = function ():void {
>             button.textContent = "Say Hello FalconJX!";
>         };
>         document.body.appendChild(button);
>     }
> }
> }
>
> ------------------------------------------------------
> JavaScript production
> ------------------------------------------------------
>
> /**
>  * Main
>  *
>  * @fileoverview
>  *
>  * @suppress {checkTypes}
>  */
>
> goog.provide('Main');
>
>
>
> /**
>  * @constructor
>  */
> Main = function() {
>   var self = this;
>   var /** @type {Element} */ button = document.createElement("button",
> null);
>   button.textContent = "Say Hello";
>   button.onclick = function() {
>     button.textContent = "Say Hello FalconJX!";
>   };
>   document.body.appendChild(button);
> };
>
>
> /**
>  * Metadata
>  *
>  * @type {Object.<string, Array.<Object>>}
>  */
> Main.prototype.FLEXJS_CLASS_INFO = { names: [{ name: 'Main', qName:
> 'Main'}] };
>