Oh, and one more thing. I need a name...I just can't come up with anything that 
sounds right.

Scott

-----Original Message-----
From:   [EMAIL PROTECTED] on behalf of Scott Hyndman
Sent:   Mon 5/22/2006 7:39 PM
To:     [email protected]
Cc:     
Subject:        [osflash] New project - ActionScript code parsing and generation

Hey guys,

I just whipped a new project that I'm using for our ActionStep GUI builder, and 
I thought that I might release it if people were interested.

This project looks at ActionScript 2.0 source files and translates them in to a 
Java object model. It collects almost all information about the classes 
including:

1. The type hierarchy (including implemented interfaces)
2. Javadoc comments on fields, methods, properties, classes and interfaces
3. The contents of methods
4. Inline values set on fields (public var foo:Number = 5 would record "5")

The object model is very rich and easy to use. There are classes to represent 
all major AS2.0 constructs, including methods, properties, interfaces, classes, 
fields and javadoc documentation.

There are some really interesting applications for an application like this. As 
an example, I whipped up a Javadoc generator using Velocity 
(http://jakarta.apache.org/velocity/), but that's just the beginning of how 
this thing could be used.

But you could even GENERATE code using this approach. For example, let's say 
you wanted to implement a pre-condition parser, so that method arguments could 
be checked with very little code. You might want to do this with a Javadoc tag 
describing the various argument contraints, looking like this:

/**
 * @NotNull(arg0)
 */
public function foo(arg0:Object):Void {
...
}

You could generate the following:

public function foo(arg0:Object):Void {
  if (arg0 == null) {
    trace("Error - arg0 cannot be null");
    throw new Error("Error - arg0 cannot be null");
  }
...
}

Pretty neat, huh?

Anyways, it's pretty quick right now, and offers a very simple API for parsing 
and generating anything from the parsed code. I'm profiling it to bring the 
time down a little, but it is really quite reasonable, taking about 2 seconds 
for the standard Flash classes and all of ActionStep (137 types).

So let me know if you guys are interested. I think this could be a platform to 
do lots of cool things with the language.

Scott


_______________________________________________
osflash mailing list
[email protected]
http://osflash.org/mailman/listinfo/osflash_osflash.org



<<winmail.dat>>

_______________________________________________
osflash mailing list
[email protected]
http://osflash.org/mailman/listinfo/osflash_osflash.org

Reply via email to