You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flex.apache.org by OmPrakash Muppirala <bi...@gmail.com> on 2015/06/01 03:02:03 UTC

Re: [FalconJX JXEmitter] Hello Greeter! working :: AS cross compiling to vanilla Javascript

On May 31, 2015 9:41 AM, "Michael Schmalle" <te...@gmail.com>
wrote:
>
> Nice, actually I am highly motivated right now. I know how much joy I had
> when getting back into it using Feathers. I think I have told you like 5
> times in the last 3 months. :)
>
> Now, I wish I had an answer of how to create a d.ts parser without using
> 100's of dev time hours. :)

Do you have an idea of how the input vs. output would look like?  Are you
planning on creating a d.as file which has all the class and function
definitions?

Perhaps we can start with hand coding a simple example?  I can help with
that.

Thanks,
Om

>
> Mike
>
> On Sun, May 31, 2015 at 12:36 PM, Josh Tynjala <jo...@gmail.com>
> wrote:
>
> > On May 29, 2015 1:36 PM, "Michael Schmalle" <te...@gmail.com>
> > wrote:
> > >
> >
> > > The fact Josh is still highly interested in ActionScript leads me to
> > > believe if we offer up real solutions to former AS devs, they might
> > > actually be overjoyed to see and use it because they know we are not
> > trying
> > > to solve world hunger here, just offer tooling that is mature.
> > >
> > > Mike
> >
> > Some extra motivation for you, Mike. :)
> >
> > https://twitter.com/walpolea/status/604855031423107074
> >

Re: [FalconJX JXEmitter] Hello Greeter! working :: AS cross compiling to vanilla Javascript

Posted by Michael Schmalle <te...@gmail.com>.
Yeah I pretty much figured that. What I can't figure out is if a d.ts
definition is actually TS or some sub type that has special rules. I looked
through the TS parser and compiler code and didn't see anything specific to
a d.ts file so I am assuming it's TS.

The problem here is two fold, one trying to create a scanner for TS and two
the language is still greek to me as far as quickly understanding how to
map a d.ts "AST" to actionscript.

As I said early, forking the TS compiler and then emitting as from it was a
first consideration but looking at the code, that ain't going to happen. :)

So in the end it's write an antlr grammar(not going to happen), create a
tokenizer by hand that uses characters and state transitions or using some
type of regexp to scan things as you parse each line thus putting the
scanner in states to save some type of simple AST that we can then
walk/visit and emit actionscript.

First the as spec for "d.as" files needs to be documented, then the tool
can be thought about. We need to think about exactly what and how this
stuff translates back to javascript during compilation (from the SWC
definition).

Mike


On Mon, Jun 1, 2015 at 12:44 AM, Alex Harui <ah...@adobe.com> wrote:

>
>
> On 5/31/15, 6:02 PM, "OmPrakash Muppirala" <bi...@gmail.com> wrote:
>
> >On May 31, 2015 9:41 AM, "Michael Schmalle" <te...@gmail.com>
> >wrote:
> >>
> >> Now, I wish I had an answer of how to create a d.ts parser without using
> >> 100's of dev time hours. :)
>
> Mike, have you checked out Microsoft’s TypeScript compiler?  It seems to
> be on GitHub at [1].
> I’d guess that [2] is their parser/scanner.  It looks like the scanning is
> done in TS itself which is probably why you couldn’t find a grammar.
>
> -Alex
>
> [1] https://github.com/Microsoft/TypeScript
> [2]
> https://github.com/Microsoft/TypeScript/blob/270a149571b106dcfbbaee53897074
> 61e8fedcb9/src/compiler/scanner.ts
>
>

Re: [FalconJX JXEmitter] Hello Greeter! working :: AS cross compiling to vanilla Javascript

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

On 5/31/15, 6:02 PM, "OmPrakash Muppirala" <bi...@gmail.com> wrote:

>On May 31, 2015 9:41 AM, "Michael Schmalle" <te...@gmail.com>
>wrote:
>>
>> Now, I wish I had an answer of how to create a d.ts parser without using
>> 100's of dev time hours. :)

Mike, have you checked out Microsoft’s TypeScript compiler?  It seems to
be on GitHub at [1].
I’d guess that [2] is their parser/scanner.  It looks like the scanning is
done in TS itself which is probably why you couldn’t find a grammar.

-Alex

[1] https://github.com/Microsoft/TypeScript
[2] 
https://github.com/Microsoft/TypeScript/blob/270a149571b106dcfbbaee53897074
61e8fedcb9/src/compiler/scanner.ts


Re: [FalconJX JXEmitter] Hello Greeter! working :: AS cross compiling to vanilla Javascript

Posted by Josh Tynjala <jo...@gmail.com>.
The "native" keyword might be useful for creating classes that provide APIs
for JavaScript libraries:

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/statements.html#native

It's meant for APIs that are defined as native code in the runtime. I
suspect that this is part of how playerglobal.swc is created. The
documentation says that it "cannot be used in your own code." However, I
just did a quick test, and the compiler accepts it. The Flash runtime
throws an error when you try to run the SWF, but for our purposes, it's
just the compiler that matters.

- Josh



On Sun, May 31, 2015 at 6:02 PM, OmPrakash Muppirala <bi...@gmail.com>
wrote:

> On May 31, 2015 9:41 AM, "Michael Schmalle" <te...@gmail.com>
> wrote:
> >
> > Nice, actually I am highly motivated right now. I know how much joy I had
> > when getting back into it using Feathers. I think I have told you like 5
> > times in the last 3 months. :)
> >
> > Now, I wish I had an answer of how to create a d.ts parser without using
> > 100's of dev time hours. :)
>
> Do you have an idea of how the input vs. output would look like?  Are you
> planning on creating a d.as file which has all the class and function
> definitions?
>
> Perhaps we can start with hand coding a simple example?  I can help with
> that.
>
> Thanks,
> Om
>
> >
> > Mike
> >
> > On Sun, May 31, 2015 at 12:36 PM, Josh Tynjala <jo...@gmail.com>
> > wrote:
> >
> > > On May 29, 2015 1:36 PM, "Michael Schmalle" <teotigraphixllc@gmail.com
> >
> > > wrote:
> > > >
> > >
> > > > The fact Josh is still highly interested in ActionScript leads me to
> > > > believe if we offer up real solutions to former AS devs, they might
> > > > actually be overjoyed to see and use it because they know we are not
> > > trying
> > > > to solve world hunger here, just offer tooling that is mature.
> > > >
> > > > Mike
> > >
> > > Some extra motivation for you, Mike. :)
> > >
> > > https://twitter.com/walpolea/status/604855031423107074
> > >
>