Yeah but good enough to dare glance at the code now :)

Thanks again.

-Fred

-----Message d'origine----- From: FrédericCox
Sent: Friday, January 18, 2013 5:11 PM
To: dev@flex.apache.org
Subject: Re: [FalconJx] where I'm going to be

That is interesting stuff! And more understandable now :-) (not fully yet
;-))

Thanks for your time and effort. I'm very pleased to see Erik has plans
for the views handling from MXML to HTML DOM. That is an interesting part
of the project too :-)

Fréderic Cox




On 18/01/13 17:06, "Frédéric THOMAS" <webdoubl...@hotmail.com> wrote:

Waou, that's just the golden needed missing informations, that has
absolutely to be reported on the wiki with the previous clarification,
thanks for you time Mike :)

-Fred

-----Message d'origine-----
From: Michael Schmalle
Sent: Friday, January 18, 2013 4:51 PM
To: dev@flex.apache.org
Subject: Re: [FalconJx] where I'm going to be


Quoting Frédéric THOMAS <webdoubl...@hotmail.com>:

Mike,

Yes, that's a clear introduction of what it aims to and it was
important
to clarify that.

Ok good.

On the wiki page, l would like to understand little bit more, even  if
maybe, not sure, I can figure out what is a javascript target,  AST
walker, JavaScript emitter and node switch strategy, it would be  nice
if
it would be explained.

Yes, I know that all sounds alien. I am positive I can make it sound
logical and understandable also.

The parser
-------------------

AST stands for Abstract Syntax Tree avery complicated way of saying
Objects that have parents and children. When an .as file is parsed by
Falcon, the parser creates "blocks" of things it recognizes from the
string tokens feed to it as it's running through the source file. A
token is a String defined my the AS3 language spec IE "class", "if",
"{", "foo" etc.

As the parser accepts these tokens from the stream, it recognizes
patterns like "public" is a namespace if it happens just before the
"class" token. So as the parser runs through these rules and finds
matches, it creates IASNode instance such as IClassNode, IIdentifier
node etc.

Each node in the tree represents a part of the ActionScript file. If
you actually look at an .as you can see how it's very nature is
heiracle, that is the AST tree and the IASNode subclasses represent
that tree.

We can also call this tree a DOM or Document Object Model. So when we
say AST we also mean ActionScript DOM because there is only one
semantic way that DOM will be constructed by the ASParser's grammar.
It's exactly what a Browser does with the HTML DOM, there are rules
and the only way the browser's parser will create an element in the
DOM is if you source code matches the rules.

The walker
-------------------------

Just as you would create a recursive function to traverse HTML with
JavaScript, we can do the same thing with the AS3 DOM (AST) which I
have done.

The only hard part about this is you have to be familiar with the
"grammar" or API of the DOM to make sure you recursively traverse it
in the correct order and get everything. That is why Erik and I have
over 500 unit tests, this is making sure we are producing the whole
language correctly.

So once the DOM is created, we call walke.visitFile(fileNode), which
the IFileNode is the root of the tree, just like window is the root of
the HTML DOM.

Visit file will then abstractly call visitPackage(), then
visitClass(), then visitMethod(), visitBlock(), visitIf(),
visitBinary() etc. The visit methods are called through the node
switch strategy class. This is kindof complicated but not really, it's
kindof a juggling act back and forth so the whole node handler
traversing calls the correct visit method based on the current node's
type, is it a function, expression etc.

You see, that when each of the nodes in the tree are visited
recursively, the String emitter is called to emit the javascript or
actionscript source code into the buffer.

The backend
----------------------------

The backend stuff is going to be refactored and I have some ideas
about the compiler setup but basically, the way the actual compiler is
setup and the design of FalconJx, it allows tremendous flexibility on
overriding things for different JavaScript output,  the final string
that gets written to disk with the .js extension.

Like right now Erik has a Goog and AMD output that are separate
implementations but use the same core framework.

On a final note, this framework was first written by me to create
valid ActionScript. So what is actually happening is we are taking
advantage of the fact JavaScript is ECMA just like AS, so we are only
overriding the parts of the two languages that differ for source code
production.

In the end, FalconJx is actually an ActionScript emitter first, other
languages next.

Mike





-Fred.

-----Message d'origine----- From: Michael Schmalle
Sent: Friday, January 18, 2013 4:03 PM
To: dev@flex.apache.org
Subject: Re: [FalconJx] where I'm going to be

Yeah,

When I wrote that I was basically brainstorming and talking to myself.

Since it's in the trunk now, it does require a more laymans
explanation which I will work on.

Really, here is the Overview.

"FalconJx is being designed to be able to compile ActionScript3 source
code business logic to JavaScript business logic. At the moment, there
are no plans for the "majic bullet" compile to SWF and Browser with
the same view code."

When I say business logic, I mean, no views, no ui components, no
flash display list to javascript DOM conversations. Just business logic.

My main intention is not to "bloat" the project's definition with over
expectations like what happened in the definition of FalconJS.

I just want to be able to write OOP type strict code in AS3 and
compile it to JavaScript at the moment.


Mike


Quoting Frédéric THOMAS <webdoubl...@hotmail.com>:

Mike,

Q: How does it work?

A: Basically we are utilizing the fantastic AST IASNode structure,
traversing the nodes and visiting them individually with an  emitter.
The difference here is the AST walker is a hand written
implementation
that can easily be maintained and optimized per   individual specs.


I've been lost right after the word "Basically", as many people who
never did anything regarding compilers but compiling, there are  some
words that hurts :) that's the reason why I said
"introduction/overview
" meaning something more basic that could   help to understand what is
written on the wiki page.

-Fred

-----Message d'origine----- From: Michael Schmalle
Sent: Friday, January 18, 2013 3:38 PM
To: dev@flex.apache.org
Subject: Re: [FalconJx] where I'm going to be

I outlined some of this a while ago;

https://cwiki.apache.org/confluence/display/FLEX/FalconJx+Prototype

Mike


Quoting Frédéric THOMAS <webdoubl...@hotmail.com>:

Yes, you right Carol, this information is very helpful and even
more
that, a good introduction/overview of how it works, what's  the  AST,
..., would be also welcomed I guess.

-Fred

-----Message d'origine----- From: Carol Frampton
Sent: Friday, January 18, 2013 3:30 PM
To: dev@flex.apache.org
Subject: Re: [FalconJx] where I'm going to be

This would be good info to post somewhere on the website since I'm
sure
Frederic isn't the only one wondering.

Carol

On 1/18/13 6 :41AM, "Erik de Bruin" <e...@ixsoftware.nl> wrote:

Frederic,

There are currently two JS cross compilation projects happening:
FalconJS and FalconJx.

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+Proto
type

FalconJx is the 'alternative' project from Michael Schmalle. It uses
an alternative approach to AS3 compilation (don't ask for details, I
have no clue about the innards of that code). One of it's main
selling
points (from my humble point of view) is that it has a very flexible
architecture for outputting different flavours of JS. The status of
this project is that we are working on getting complete AS3 language
feature coverage in place. This means that we are working towards
~100% translation of AS into JS. I'm using the Google Closure Tools
to
augment standard JS to try and match the original AS language
features. This is coming along nicely, but I'm sure the devil will be
in the details. Read more on the 'goog' way here:


https://cwiki.apache.org/confluence/display/FLEX/AS+to+JS+-+the+%27goo
g%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 :-)

Have fun,

EdB




On Fri, Jan 18, 2013 at 12:24 PM, Fréderic Cox
<coxfrede...@gmail.com>
wrote:
I'm following your work with great interest, but I'm afraid as a
"regular"
AS3 developer with no background in compilers this is a bit too
technical
for me. I was wondering if you could explain in a non-technical way
what
the status of the project is at this moment.

Questions I have:

- I have an AS3 project, what can I do with FalconJx? Will it run
in
the
browser already?
- I have a Flex project with MXML, can it run in the browser with
FalconJx
instead of Flash Player?
- Is it technically possible to write in AS3/MXML and without Flash
run
the content in the browser, how does it reflect to the "pages"
paradigm
(history) and the DOM?

Thanks for your hard work, just trying to understand where we are
at
at
this moment

Fréderic Cox




On 18/01/13 12:19, "Michael Schmalle" <apa...@teotigraphix.com>
wrote:

Hey all,

Since the project is really taking shape thanks to our great
cooperation, I am going to focus on the nemesis I have left and
that
is finishing of the ActionScript emitter.

This project blew up fast with Erik contributing, I didn't get a
chance to fully finish the ActionScript impl. Yes, I might have
plans
down the road to make a read/write AS DOM and having a fully
functional AS3 emitter is essential.

Mike

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






--
Ix Multimedia Software

Jan Luykenstraat 27
3521 VB Utrecht

T. 06-51952295
I. www.ixsoftware.nl



--
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



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



Reply via email to