Thank you both for the suggestion, we've started using Falcon, and indeed, it seems that the AST is much easier to use, and the code is well documented.

So far, we have obtained the AST for an AS file, and now we are looking for a way to do rewriting. We want to be able to make modifications to the AST (e.g. change the return type of a function, add a parameter), and then generate the AS code to show these modifications (i.e. with the new return type or parameter etc). Is there any functionality already implemented in Falcon that would help us achieve this? E.g. listening to AST changes, generating AS code from an AST node.

Any hints would be appreciated!

Mariana


On 27.06.2014 22:44, Gordon Smith wrote:
I agree that you should investigate using Falcon. think you'll find that the 
classes making up Falcon's AST are reasonably intuitive and have good Javadoc 
documentation.
If you get Falcon compiling in Eclipse and run a compile in Debug mode, you'll see an indented tree-like representation of the AST whenever you inspect an AST node instance. - Gordon
From: aha...@adobe.com
To: users@flex.apache.org
Subject: Re: ActionScript AST
Date: Fri, 27 Jun 2014 05:44:50 +0000



On 6/26/14 6:21 AM, "Mariana Gheorghe" <mariana.gheor...@crispico.com>
wrote:

Hello,

We are looking for a way to obtain and rewrite the AST (abstract syntax
tree) for an AS file. Currently, we are using the compiler library that
comes with the SDK, and we've obtained the AST rooted at a ProgramNode.
We are now unsure on how to proceed to: a) make modifications to the
tree (e.g. add a variable, add a parameter to a function), and b)
generate the code from a (modified) tree. Any hints on how to do this
would be appreciated!
I find the MXMLC code to be very difficult.

Also, we were wondering about the status of Falcon, and if we should in
fact use Falcon to obtain/rewrite the AST, instead of the compiler from
the SDK.
Falcon has released a 0.0.1 alpha, we'll ship a 0.0.2 soon.  I find the
code base much easier to work with.

-Alex

                                        

Reply via email to