incubator-flex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Schmalle <apa...@teotigraphix.com>
Subject Re: Writable AST and Code generation for Falcon was: [Re: [jira] [Commented] (FLEX-33330) ... )
Date Sat, 29 Dec 2012 13:28:12 GMT

Quoting Roland Zwaga <roland@stackandheap.com>:

>> I was thinking, maybe I'm not thinking in enough 5th dimensional thought
>> here.
>>
>> I'm not married to linked tokens, because other than Gordon helping out I
>> highly doubt I would even have time to implement that with the current
>> parser.
>>
>> The code when parsed has insane AST source offsets to everything in the
>> actual source file. If we were "injecting" AST into a class/method/etc., we
>> would just basically be substringing it with a replace. The code generation
>> could be done already with the AS emitter I have already made with FalconJx!
>>
>> Holy #$%@! I think that might actually work! :)
>>
>
> Hm, sounds pretty sweet. If its not too much work to create a small
> experiment to proof your theory than this could be a worthy approach :)

Heh, you know me, I will probably have something working sooner than  
later. If I don't waste to much time making trance music...


> Generating extra classes etc shouldn't be a problem I suppose?

We can already do this with ASEmitter.java in FalconJx, look at all  
the unit tests. :)


> What the AOP bits would do, in a nutshell, would basically be renaming an
> existing class, creating a new class with the old name of this class (and
> making it a subclass of the original) and then creating overridden methods
> in the new class.
> Come to think of, with this approach we wouldn't even need to inject
> subtrees into existing AST's... All I need to do is rename certain classes,
> I'm guessing that that wouldn't be too much of a hassle, right?

Right, API to IClassNode.setName("MyClassBase")

There is a step here that doesn't exist which would be like  
writeChanges(whatChanges), which is about the only aspect of this that  
needs more than 10 minutes of thought, everything else is covered.

Side note; The Falcon parser is so fast that to update offsets after  
code is inserted is just a matter of reparsing the file with the new  
code, this will give you updated AST without changing the source file  
yet.

Mike


> Roland
>

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


Mime
View raw message