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 <ap...@teotigraphix.com> on 2012/12/09 22:24:19 UTC

[FalconJx] A new baby cross compiler experiement for AS -> JS using Falcon

Hi,

Seeing as winter is here in NewHampshire and ice covers the ground, I  
used the opportunity to put my money where my mouth is;

NOTE: All the javascript is generated by code I wrote using the  
AST/Visitor/Walker pattern of the node hierarchy and their  
corresponding definitions. I have it running from the command line  
like MXMLC does.

I about 10 hours of programing I have the following constructs cross  
compiling to JS using Flacon.

I will say, Falcon is one of the best designed APIs I have used in a  
long time. Whoever architected this compiler gets a huge pat on the  
back from me.

Right now this is hoisted ontop of MXMLC as a quasi target compiler.  
Oh how I love prototypes. I cannot believe I actually have this  
working in less than two days.

As far as code, it will be in my whiteboard when it's in my  
whiteboard. :) Whenever that is, no specific time.

The amount of ridiculousness I felt trying to wade through the  
FlaconJS code prompted me to do this.

The thing I really grabbed on to is we are using the closure compiler  
so worrying about highly optimized cross compiler becomes a non issue.  
Quote Erik on this.

//-------------------------------------------------------
// ActionScript class

package com.example.components
{
	import flash.display.Sprite;
     import flash.events.Event;

     public class MyTextButton extends Sprite
     {
         public var foo:Number = 100;

         protected var baz:String = "what are you doing";

         private var _goo:String = 'goog';

         private var _bar:int = 1 + 3;

         public function MyTextButton()
         {
             super();
             testFunc(4, "20");
             for (var b:int=1;b<=10;b++) {
             	bar();
             }
             for (;;) { break foo; }
             for (var g:int in blah) { r(); }
             for each (var g:Object in baz[goo]) { r(); }
             if (a) b();
             while (false) v();
             do { continue; } while (m);
             if (true) {
             	if (a) {
             	} else {
	            if (b == c) {
			foo.bar['baz']['goo'].baz(42);
		    } else if (c != d) {
		    } else {
		        trace('mike');
		    }
             	}
             } else if (false) {
             } else if (a < 3) {
             } else {
             }
             return a.call(i.j*k, l[m]);
         }

         public function testFunc(a:int = 4, b:String = null):Event
         {
             print();
             return null;
         }
     }
}

// end ActionScript
/////////////////////////////////////////////////////////




//-------------------------------------------------------
// Javascript class


/**
  * CROSS-COMPILED BY MXMLJxC (329449.1) ON 2012-12-09 16:07:04
  */
goog.provide('com.example.components.MyTextButton');

goog.require('flash.display.Sprite');
goog.require('flash.events.Event');

/**
  * @constructor
  * @extends {flash.display.Sprite}
  */
com.example.components.MyTextButton = function()
{
	goog.base(this);
	/**
	 * @type {string}
	 */
	this._goo = 'goog';
	/**
	 * @type {number}
          */
	this._bar = 1 + 3;
	testFunc(4, "20");
	for(var b = 1;b <= 10;++b;){
		bar();
	}
	for(;;){
		break foo;
	}
	for(var g in blah){
		r();
	}
	for each(var g in baz[goo]){
		r();
	}
	if(a){
		b();
	}
	while(false){
		v();
	}
	do{
		continue;
	}while(m);
	if(true){
		if(a){
		}else{
			if(b == c){
				foo.bar['baz']['goo'].baz(42);
			}else if(c != d){
			}else{
				trace('mike');
			}
		}
	}else if(false){
	}else if(a < 3){
	}else{
	}
	m =
	return a.call(i.j * k, l[m]);
}

goog.inherits(com.example.components.MyTextButton, flash.display.Sprite);

/** @type {number} */
com.example.components.MyTextButton.prototype.foo = 100;

/** @type {string} */
com.example.components.MyTextButton.prototype.baz = "what are you doing";


/**
  * @this {com.example.components.MyTextButton}
  * @param {int} a
  * @param {String} b
  * @return {Event}
  */
com.example.components.MyTextButton.testFunc = function(a, b)
{
	print();
	return null
}

// end Javascript
/////////////////////////////////////////////////////////


Peace,
Mike

-- 
Michael Schmalle - Teoti Graphix, LLC
http://www.teotigraphix.com
http://blog.teotigraphix.com


Re: [FalconJx] A new baby cross compiler experiement for AS -> JS using Falcon

Posted by Frank Wienberg <fr...@jangaroo.net>.
Alex, thanks for the advice, it's my first time in an Apache project, so
any help on processes is highly appreciated.
I'll clarify these issues with my employer!
-Frank-


On Mon, Dec 10, 2012 at 8:41 AM, Alex Harui <ah...@adobe.com> wrote:

>
>
>
> On 12/9/12 11:28 PM, "Frank Wienberg" <fr...@jangaroo.net> wrote:
>
> > Mike, this is really great news! Wow! I'd really like to get my hands on
> > that code of yours!
> I'd like to see it too.  FWIW, I think I have successfully found a way to
> get FalconJS to call my MXMLClassDirectiveProcessor so I think I can now
> start generating JS from MXML.
>
> > What else do you need? Would it make sense if I helped coding stuff?
> Frank, if you plan to contribute code, I think it would be a good idea to
> file a CCLA from your employer and an ICLA for yourself.  Even though
> Jangaroo is OS and AL, it is still important that contributions are
> voluntary and ok'd by your employer.  And significant contributions of
> existing code may need a software grant.
>
> http://www.apache.org/licenses/cla-corporate.txt
> http://www.apache.org/licenses/icla.txt
>
> --
> Alex Harui
> Flex SDK Team
> Adobe Systems, Inc.
> http://blogs.adobe.com/aharui
>
>

Re: [FalconJx] A new baby cross compiler experiement for AS -> JS using Falcon

Posted by Michael Schmalle <ap...@teotigraphix.com>.
Quoting Frank Wienberg <fr...@jangaroo.net>:

> Mike, what about this approach: you continue on your path, and I go ahead
> and tweak Jangaroo to generate code using the "goog" API (where is makes
> sense, see my comment on the Wiki page) instead of the Jangaroo Runtime, so
> I can experiment with what the desired output format would be without
> having to get up and working with Falcon.
> Does that sound like it could work?
>

Sounds good, we need all the momentum we can get. Right now I'm just  
really trying to figure out the whole structure of what I'm working on.


Mike


-- 
Michael Schmalle - Teoti Graphix, LLC
http://www.teotigraphix.com
http://blog.teotigraphix.com


Re: [FalconJx] A new baby cross compiler experiement for AS -> JS using Falcon

Posted by Frank Wienberg <fr...@jangaroo.net>.
Mike, what about this approach: you continue on your path, and I go ahead
and tweak Jangaroo to generate code using the "goog" API (where is makes
sense, see my comment on the Wiki page) instead of the Jangaroo Runtime, so
I can experiment with what the desired output format would be without
having to get up and working with Falcon.
Does that sound like it could work?

Re: [FalconJx] A new baby cross compiler experiement for AS -> JS using Falcon

Posted by Michael Schmalle <ap...@teotigraphix.com>.

Quoting Frank Wienberg <fr...@jangaroo.net>:

> Mike, this is really great news! Wow! I'd really like to get my hands on
> that code of yours!


I made sure I didn't use any code from anywhere except my head on this  
first iteration. I also used some of my experience when I made an as3  
code creator framework a couple years ago.

I didn't want to use any Jangaroo code until you have official  
approval and forms that Alex mentioned submitted. I think the form  
from your employer would probably be very important.

- see [0] asblocks

What will have to be figured out eventually that I am not sure about  
is project setup, threading(since falcon is multithreaded) and write  
optimizations but, this is the great thing about opensource. People  
with different levels of experience can contribute!


- [0]  
https://github.com/teotigraphix/as3-commons-jasblocks/tree/master/src/main/java/org/as3commons/asblocks


> On Mon, Dec 10, 2012 at 12:27 AM, Michael Schmalle
> <ap...@teotigraphix.com>wrote:
>
>> How do we want default arguments dealt with on functions?
>
>
> What about this:
> http://blog.jangaroo.net/2012/01/simulating-actionscript-parameter.html
> And the follow-up about the "... (rest)" parameter:
> http://blog.jangaroo.net/2012/01/simulating-actionscript-rest-parameter.html
>
> Also, I wrote a lengthy
> comment<https://cwiki.apache.org/confluence/display/FLEX/AS+to+JS+translation+table?focusedCommentId=30744332#comment-30744332>for
> the AS->JS translation table concerning field initializers.

I will look into this, thanks!

> What else do you need? Would it make sense if I helped coding stuff?

Like I said, I think Alex was correct that you just need to make sure  
your legally clear from your employer and have forms submitted if you  
use code from janagroo in places.

Other than that, I would love as much help as possible, you put enough  
effort in, you will be an apache flex committer in no time. :)

So I will try and get the code looking decent, licenses and stuff and  
just get it into my whiteboard and not worry about it. I think I have  
enough support here, that we can mold it into the shape it needs to be.

Mike


> -Frank-
>

-- 
Michael Schmalle - Teoti Graphix, LLC
http://www.teotigraphix.com
http://blog.teotigraphix.com


Re: [FalconJx] A new baby cross compiler experiement for AS -> JS using Falcon

Posted by Michael Schmalle <ap...@teotigraphix.com>.
Quoting Frank Wienberg <fr...@jangaroo.net>:

> Okay, so for the time being, I'll continue to share my experience / ideas
> here on the mailing list and by commenting in the Wiki.
> In case you are not watching the Wiki page, I just struck
> again<https://cwiki.apache.org/confluence/display/FLEX/AS+to+JS+translation+table?focusedCommentId=30744456#comment-30744456>
> ...
> -Frank-

Yeah, I'm receiving notifications on that page. I'm a tooler, like I  
said, I cannot in good faith even offer my opinion when it comes to  
implementation details of javascript (IE super).

With the design I am going to commit sooner than later, we can change  
things very easily, it's quite modular.

What I need to figure out is how I'm going to setup unit testing so we  
can test FIRST and add functionality after the base expressions and  
statements work correctly.

Mike


>
> On Mon, Dec 10, 2012 at 10:05 AM, Michael Schmalle
> <ap...@teotigraphix.com>wrote:
>
>>
>> Quoting Alex Harui <ah...@adobe.com>:
>>
>>
>>>
>>>
>>> On 12/9/12 11:28 PM, "Frank Wienberg" <fr...@jangaroo.net> wrote:
>>>
>>>  Mike, this is really great news! Wow! I'd really like to get my hands on
>>>> that code of yours!
>>>>
>>> I'd like to see it too.  FWIW, I think I have successfully found a way to
>>> get FalconJS to call my MXMLClassDirectiveProcessor so I think I can now
>>> start generating JS from MXML.
>>>
>>
>> Like I told Frank, I will get the code up ASAP. FalconJS is just "to deep"
>> for me Alex. I don't feel comfortable investing a huge amount of time
>> hacking something I don't understand.
>>
>> I for some reason this new design pattern doesn't work out, I will force
>> myself to learn FalconJS's internals. I spent 8 hours on Friday trying to
>> mangle code around and I found myself hacking a couple things like super
>> because the implementation of the BURM and other renderings were so
>> complex. Yes I was stepping through the code and saw exactly what it was
>> doing. :)
>>
>> On a side note, I would love to see your implementation of the
>> MXMLClassDirectiveProcessor. I would like to see if I can make a traversal
>> just like I have done here with as AST.
>>
>> Mike
>>
>>
>>
>>  What else do you need? Would it make sense if I helped coding stuff?
>>>>
>>> Frank, if you plan to contribute code, I think it would be a good idea to
>>> file a CCLA from your employer and an ICLA for yourself.  Even though
>>> Jangaroo is OS and AL, it is still important that contributions are
>>> voluntary and ok'd by your employer.  And significant contributions of
>>> existing code may need a software grant.
>>>
>>> http://www.apache.org/**licenses/cla-corporate.txt<http://www.apache.org/licenses/cla-corporate.txt>
>>> http://www.apache.org/**licenses/icla.txt<http://www.apache.org/licenses/icla.txt>
>>>
>>> --
>>> Alex Harui
>>> Flex SDK Team
>>> Adobe Systems, Inc.
>>> http://blogs.adobe.com/aharui
>>>
>>>
>>>
>> --
>> Michael Schmalle - Teoti Graphix, LLC
>> http://www.teotigraphix.com
>> http://blog.teotigraphix.com
>>
>>
>

-- 
Michael Schmalle - Teoti Graphix, LLC
http://www.teotigraphix.com
http://blog.teotigraphix.com


Re: [FalconJx] A new baby cross compiler experiement for AS -> JS using Falcon

Posted by Frank Wienberg <fr...@jangaroo.net>.
Okay, so for the time being, I'll continue to share my experience / ideas
here on the mailing list and by commenting in the Wiki.
In case you are not watching the Wiki page, I just struck
again<https://cwiki.apache.org/confluence/display/FLEX/AS+to+JS+translation+table?focusedCommentId=30744456#comment-30744456>
...
-Frank-


On Mon, Dec 10, 2012 at 10:05 AM, Michael Schmalle
<ap...@teotigraphix.com>wrote:

>
> Quoting Alex Harui <ah...@adobe.com>:
>
>
>>
>>
>> On 12/9/12 11:28 PM, "Frank Wienberg" <fr...@jangaroo.net> wrote:
>>
>>  Mike, this is really great news! Wow! I'd really like to get my hands on
>>> that code of yours!
>>>
>> I'd like to see it too.  FWIW, I think I have successfully found a way to
>> get FalconJS to call my MXMLClassDirectiveProcessor so I think I can now
>> start generating JS from MXML.
>>
>
> Like I told Frank, I will get the code up ASAP. FalconJS is just "to deep"
> for me Alex. I don't feel comfortable investing a huge amount of time
> hacking something I don't understand.
>
> I for some reason this new design pattern doesn't work out, I will force
> myself to learn FalconJS's internals. I spent 8 hours on Friday trying to
> mangle code around and I found myself hacking a couple things like super
> because the implementation of the BURM and other renderings were so
> complex. Yes I was stepping through the code and saw exactly what it was
> doing. :)
>
> On a side note, I would love to see your implementation of the
> MXMLClassDirectiveProcessor. I would like to see if I can make a traversal
> just like I have done here with as AST.
>
> Mike
>
>
>
>  What else do you need? Would it make sense if I helped coding stuff?
>>>
>> Frank, if you plan to contribute code, I think it would be a good idea to
>> file a CCLA from your employer and an ICLA for yourself.  Even though
>> Jangaroo is OS and AL, it is still important that contributions are
>> voluntary and ok'd by your employer.  And significant contributions of
>> existing code may need a software grant.
>>
>> http://www.apache.org/**licenses/cla-corporate.txt<http://www.apache.org/licenses/cla-corporate.txt>
>> http://www.apache.org/**licenses/icla.txt<http://www.apache.org/licenses/icla.txt>
>>
>> --
>> Alex Harui
>> Flex SDK Team
>> Adobe Systems, Inc.
>> http://blogs.adobe.com/aharui
>>
>>
>>
> --
> Michael Schmalle - Teoti Graphix, LLC
> http://www.teotigraphix.com
> http://blog.teotigraphix.com
>
>

Re: [FalconJx] A new baby cross compiler experiement for AS -> JS using Falcon

Posted by Alex Harui <ah...@adobe.com>.


On 12/10/12 9:56 AM, "Michael Schmalle" <ap...@teotigraphix.com> wrote:

> 
> Quoting Alex Harui <ah...@adobe.com>:
> 
>> Mike,
>> 
>> What are you planning to do with your Friday work?  Assuming I get time to
>> work on my MXMLClassDirectiveProcessor today or tomorrow, I think I want to
>> teach it to spit out the goog code, but then I need the AS output to also do
>> the same.  Maybe I'll just try make the changes for the AS output myself in
>> the current Reducer/Emitter classes?
> 
> I don't know. By all means I am not saying I'm giving up on what I
> have done and FalconJS. I don't even "know" if what I have created is
> going to be suitable.
> 
> I really don't want to commit what I have to svn and I didn't make a
> branch. I could always recheck it out again and copy/paste.
> 
> I changed quite a bit in the JSEmitter, JSWriter, JSSharedData and
> JSGeneratingReducer.
> 
I haven't dug into Erik's changes, yet, but I assume that we want to get
base.js output ASAP, and it sounds like you are several days out on checking
in your version?  If so, then I will try to make the required changes to the
FalconJS classes myself.  If you want to send me your changes directly, feel
free.

-- 
Alex Harui
Flex SDK Team
Adobe Systems, Inc.
http://blogs.adobe.com/aharui


Re: [FalconJx] A new baby cross compiler experiement for AS -> JS using Falcon

Posted by Michael Schmalle <ap...@teotigraphix.com>.
Quoting Alex Harui <ah...@adobe.com>:

> Mike,
>
> What are you planning to do with your Friday work?  Assuming I get time to
> work on my MXMLClassDirectiveProcessor today or tomorrow, I think I want to
> teach it to spit out the goog code, but then I need the AS output to also do
> the same.  Maybe I'll just try make the changes for the AS output myself in
> the current Reducer/Emitter classes?

I don't know. By all means I am not saying I'm giving up on what I  
have done and FalconJS. I don't even "know" if what I have created is  
going to be suitable.

I really don't want to commit what I have to svn and I didn't make a  
branch. I could always recheck it out again and copy/paste.

I changed quite a bit in the JSEmitter, JSWriter, JSSharedData and  
JSGeneratingReducer.


> You might want to feed an MXML file into Falcon and watch it hit the
> MXMLClassDirectiveProcessor APIs.  All I"m going to do is override each of
> those APIs and instead of sticking ABC code in the instruction lists, stick
> in single instructions that are a string of JS.  That's my understanding of
> how JSEmitter works today.
>

I'll look at this.

Mike

-- 
Michael Schmalle - Teoti Graphix, LLC
http://www.teotigraphix.com
http://blog.teotigraphix.com


Re: [FalconJx] A new baby cross compiler experiement for AS -> JS using Falcon

Posted by Alex Harui <ah...@adobe.com>.
Mike,

What are you planning to do with your Friday work?  Assuming I get time to
work on my MXMLClassDirectiveProcessor today or tomorrow, I think I want to
teach it to spit out the goog code, but then I need the AS output to also do
the same.  Maybe I'll just try make the changes for the AS output myself in
the current Reducer/Emitter classes?

You might want to feed an MXML file into Falcon and watch it hit the
MXMLClassDirectiveProcessor APIs.  All I"m going to do is override each of
those APIs and instead of sticking ABC code in the instruction lists, stick
in single instructions that are a string of JS.  That's my understanding of
how JSEmitter works today.


On 12/10/12 1:05 AM, "Michael Schmalle" <ap...@teotigraphix.com> wrote:

> 
> Quoting Alex Harui <ah...@adobe.com>:
> 
>> 
>> 
>> 
>> On 12/9/12 11:28 PM, "Frank Wienberg" <fr...@jangaroo.net> wrote:
>> 
>>> Mike, this is really great news! Wow! I'd really like to get my hands on
>>> that code of yours!
>> I'd like to see it too.  FWIW, I think I have successfully found a way to
>> get FalconJS to call my MXMLClassDirectiveProcessor so I think I can now
>> start generating JS from MXML.
> 
> Like I told Frank, I will get the code up ASAP. FalconJS is just "to
> deep" for me Alex. I don't feel comfortable investing a huge amount of
> time hacking something I don't understand.
> 
> I for some reason this new design pattern doesn't work out, I will
> force myself to learn FalconJS's internals. I spent 8 hours on Friday
> trying to mangle code around and I found myself hacking a couple
> things like super because the implementation of the BURM and other
> renderings were so complex. Yes I was stepping through the code and
> saw exactly what it was doing. :)
> 
> On a side note, I would love to see your implementation of the
> MXMLClassDirectiveProcessor. I would like to see if I can make a
> traversal just like I have done here with as AST.
> 
> Mike
> 
> 
>>> What else do you need? Would it make sense if I helped coding stuff?
>> Frank, if you plan to contribute code, I think it would be a good idea to
>> file a CCLA from your employer and an ICLA for yourself.  Even though
>> Jangaroo is OS and AL, it is still important that contributions are
>> voluntary and ok'd by your employer.  And significant contributions of
>> existing code may need a software grant.
>> 
>> http://www.apache.org/licenses/cla-corporate.txt
>> http://www.apache.org/licenses/icla.txt
>> 
>> --
>> Alex Harui
>> Flex SDK Team
>> Adobe Systems, Inc.
>> http://blogs.adobe.com/aharui
>> 
>> 

-- 
Alex Harui
Flex SDK Team
Adobe Systems, Inc.
http://blogs.adobe.com/aharui


Re: [FalconJx] A new baby cross compiler experiement for AS -> JS using Falcon

Posted by Michael Schmalle <ap...@teotigraphix.com>.
Quoting Alex Harui <ah...@adobe.com>:

>
>
>
> On 12/9/12 11:28 PM, "Frank Wienberg" <fr...@jangaroo.net> wrote:
>
>> Mike, this is really great news! Wow! I'd really like to get my hands on
>> that code of yours!
> I'd like to see it too.  FWIW, I think I have successfully found a way to
> get FalconJS to call my MXMLClassDirectiveProcessor so I think I can now
> start generating JS from MXML.

Like I told Frank, I will get the code up ASAP. FalconJS is just "to  
deep" for me Alex. I don't feel comfortable investing a huge amount of  
time hacking something I don't understand.

I for some reason this new design pattern doesn't work out, I will  
force myself to learn FalconJS's internals. I spent 8 hours on Friday  
trying to mangle code around and I found myself hacking a couple  
things like super because the implementation of the BURM and other  
renderings were so complex. Yes I was stepping through the code and  
saw exactly what it was doing. :)

On a side note, I would love to see your implementation of the  
MXMLClassDirectiveProcessor. I would like to see if I can make a  
traversal just like I have done here with as AST.

Mike


>> What else do you need? Would it make sense if I helped coding stuff?
> Frank, if you plan to contribute code, I think it would be a good idea to
> file a CCLA from your employer and an ICLA for yourself.  Even though
> Jangaroo is OS and AL, it is still important that contributions are
> voluntary and ok'd by your employer.  And significant contributions of
> existing code may need a software grant.
>
> http://www.apache.org/licenses/cla-corporate.txt
> http://www.apache.org/licenses/icla.txt
>
> --
> Alex Harui
> Flex SDK Team
> Adobe Systems, Inc.
> http://blogs.adobe.com/aharui
>
>

-- 
Michael Schmalle - Teoti Graphix, LLC
http://www.teotigraphix.com
http://blog.teotigraphix.com


Re: [FalconJx] A new baby cross compiler experiement for AS -> JS using Falcon

Posted by Alex Harui <ah...@adobe.com>.


On 12/9/12 11:28 PM, "Frank Wienberg" <fr...@jangaroo.net> wrote:

> Mike, this is really great news! Wow! I'd really like to get my hands on
> that code of yours!
I'd like to see it too.  FWIW, I think I have successfully found a way to
get FalconJS to call my MXMLClassDirectiveProcessor so I think I can now
start generating JS from MXML.

> What else do you need? Would it make sense if I helped coding stuff?
Frank, if you plan to contribute code, I think it would be a good idea to
file a CCLA from your employer and an ICLA for yourself.  Even though
Jangaroo is OS and AL, it is still important that contributions are
voluntary and ok'd by your employer.  And significant contributions of
existing code may need a software grant.

http://www.apache.org/licenses/cla-corporate.txt
http://www.apache.org/licenses/icla.txt

-- 
Alex Harui
Flex SDK Team
Adobe Systems, Inc.
http://blogs.adobe.com/aharui


Re: [FalconJx] A new baby cross compiler experiement for AS -> JS using Falcon

Posted by Frank Wienberg <fr...@jangaroo.net>.
Mike, this is really great news! Wow! I'd really like to get my hands on
that code of yours!

On Mon, Dec 10, 2012 at 12:27 AM, Michael Schmalle
<ap...@teotigraphix.com>wrote:

> How do we want default arguments dealt with on functions?


What about this:
http://blog.jangaroo.net/2012/01/simulating-actionscript-parameter.html
And the follow-up about the "... (rest)" parameter:
http://blog.jangaroo.net/2012/01/simulating-actionscript-rest-parameter.html

Also, I wrote a lengthy
comment<https://cwiki.apache.org/confluence/display/FLEX/AS+to+JS+translation+table?focusedCommentId=30744332#comment-30744332>for
the AS->JS translation table concerning field initializers.

What else do you need? Would it make sense if I helped coding stuff?

-Frank-

Re: [FalconJx] A new baby cross compiler experiement for AS -> JS using Falcon

Posted by Michael Schmalle <ap...@teotigraphix.com>.
Well this is what I have up to this point.

Some missing semi colons, maybe some other stuff. But the recursion on  
expressions, binary and unary operators are working great.

Got anonymous functions, getters, setters, try etc. working. Will have  
to be schooled on the use of 'this' and other things but the design is  
so mutable we could even implement more than one type of cross compile  
as easy as I just made this new one for the closure compiler.

How do we want default arguments dealt with on functions?

Honestly I don't know exactly how ActionScript is supposed to  
translate to JavaScript on somethings. I have namespaces and stuff  
like that working but obviously it doesn't have a js counterpart.

Erik! I need your table erm.. javascript bible for a reference of what  
we need to test against.

Ah, the beauty of this new design is we can unit test each part of the  
expression, statement conversion from as -> js! This part is so  
exciting, we will know down to the binary, unary expression if the js  
code is getting output correct.

Erik, you will have to get me a comprehensive list for comment and  
type hint locations as well.

Well that's it for me for now.

Mike


//-------------------------------------------------------
// ActionScript class

package com.example.components {

import flash.display.Sprite;
import flash.events.Event;

public class MyTextButton extends Sprite {
     public var foo:Number = 100;

     protected var baz:String = "what are you doing";

     private var _goo:String = 'goog';

     private var _bar:int = 1 + 3;

     public function get aprop():unit {
         return 0;
     }

     public function set aprop(value:unit):void {
     }

     public function MyTextButton() {
         super();
         testFunc(4, "20");
         for (var b:int = 1; b <= 10; b++) {
             bar();
         }
         for (; ;) {
             break foo;
         }
         for (var g:int in blah) {
             r();
         }
         for each (var g:Object in baz[goo]) {
             r();
         }
         if (a) b();
         while (false) v();
         do {
             continue;
         } while (m);
         if (true) {
             if (a) {
             } else {
                 if (b == c) {
                     foo.bar['baz']['goo'].baz(42);
                 } else if (c != d) {
                 } else {
                     trace('mike');
                 }
             }
         } else if (false) {
         } else if (a < 3) {
         } else {
         }
         try {
             print("me" + 42);
         } catch (e:Error) {
             that.could['be'].bad(o.o['p'], e);
         } finally {
             dont();
         }
         var b:Function = function (a:int) {
             return 2;
         }
         return a.call(i.j * k, l[m]);
     }

     public function testFunc(a:int = 4, b:String = null):Event {
         print();
         return null;
     }
}
}


// end ActionScript
/////////////////////////////////////////////////////////

//-------------------------------------------------------
// Javascript class


/**
  * CROSS-COMPILED BY MXMLJxC (329449.1) ON 2012-12-09 18:14:31
  */
goog.provide('com.example.components.MyTextButton');

goog.require('flash.display.Sprite');
goog.require('flash.events.Event');

/**
  * @constructor
  * @extends {flash.display.Sprite}
  */
com.example.components.MyTextButton = function()
{
	goog.base(this);
	this._bar = 1 + 3;
	this._goo = 'goog';
	testFunc(4, "20");
	for(var b = 1;b <= 10;++b){
		bar();
	}
	for(;;){
		break foo;
	}
	for(var g in blah){
		r();
	}
	for each(var g in baz[goo]){
		r();
	}
	if(a){
		b();
	}
	while(false){
		v();
	}
	do{
		continue;
	}while(m);
	if(true){
		if(a){
		}else{
			if(b == c){
				foo.bar['baz']['goo'].baz(42);
			}else if(c != d){
			}else{
				trace('mike');
			}
		}
	}else if(false){
	}else if(a < 3){
	}else{
	}
	try{
		print("me" + 42);
	}catch(e){
		that.could['be'].bad(o.o['p'], e);
	}finally{
		dont();
	}
	var b = function(a)
	{
		return 2
	}

	return a.call(i.j * k, l[m]);
}


goog.inherits(com.example.components.MyTextButton, flash.display.Sprite);

/** @type {Number} */
com.example.components.MyTextButton.prototype.foo = 100;

/** @type {String} */
com.example.components.MyTextButton.prototype.baz = "what are you doing";


/**
  * @this {com.example.components.MyTextButton}
  * @return {unit}
  */
com.example.components.MyTextButton.get_aprop = function()
{
	return 0
}

/**
  * @this {com.example.components.MyTextButton}
  * @param {unit} value
  * @return {void}
  */
com.example.components.MyTextButton.set_aprop = function(value)
{
}

/**
  * @this {com.example.components.MyTextButton}
  * @param {int} a
  * @param {String} b
  * @return {Event}
  */
com.example.components.MyTextButton.testFunc = function(a, b)
{
	print();
	return null
}



// end Javascript
/////////////////////////////////////////////////////////










Quoting Michael Schmalle <ap...@teotigraphix.com>:

>
> Hi,
>
> Seeing as winter is here in NewHampshire and ice covers the ground,  
> I used the opportunity to put my money where my mouth is;
>
> NOTE: All the javascript is generated by code I wrote using the  
> AST/Visitor/Walker pattern of the node hierarchy and their  
> corresponding definitions. I have it running from the command line  
> like MXMLC does.
>
> I about 10 hours of programing I have the following constructs cross  
> compiling to JS using Flacon.
>
> I will say, Falcon is one of the best designed APIs I have used in a  
> long time. Whoever architected this compiler gets a huge pat on the  
> back from me.
>
> Right now this is hoisted ontop of MXMLC as a quasi target compiler.  
> Oh how I love prototypes. I cannot believe I actually have this  
> working in less than two days.
>
> As far as code, it will be in my whiteboard when it's in my  
> whiteboard. :) Whenever that is, no specific time.
>
> The amount of ridiculousness I felt trying to wade through the  
> FlaconJS code prompted me to do this.
>
> The thing I really grabbed on to is we are using the closure  
> compiler so worrying about highly optimized cross compiler becomes a  
> non issue. Quote Erik on this.
>

>
>
> Peace,
> Mike
>
> -- 
> Michael Schmalle - Teoti Graphix, LLC
> http://www.teotigraphix.com
> http://blog.teotigraphix.com
>
>

-- 
Michael Schmalle - Teoti Graphix, LLC
http://www.teotigraphix.com
http://blog.teotigraphix.com