At the end of my FOTB session I wanted to show you my latest tool called AS3V. Time was short and there was a small glitch so I could not show it. But now I can explain what AS3V really is without having to rush.
AS3V is basically a tool that can check for syntactical correctness. It will do with your code what a compiler does but it keeps formatting metadata. That way it can generate an XML skeleton of your code and apply rules on the XML.
You can have a look at the first output AS3V produces here. The original source code is included in the comment at the top.
As you can see it will be possible to force coding standards for instance and to warn if code could be optimized. I hope that it will be possible to have a first version of a stable parser soon. ANTLR is still giving me a lot of trouble but it is the first time for me working with such a tool as well.

That’s a whoooooole lot of XML for one simple class.
Have you run it through the Flex framework yet? *covers eyes*
The XML can be optimized and it will be definitly :) But it is the whole parse tree on the other hand.
I was running it over some classes of the Flex framework but it is just not done. I have to implement the island grammars first (RegExp, E4X, XML).
I really like the sound of it a lot and I could see a tool like this being something that my company would use quite often. But I agree with Sen, the amount of xml scares me. We have hundreds of classes totaling tens of thousands of lines of code, so the performance of it all would make it or break it for us. Either way, sounds like a great concept though. Thanks!
This has huge potential… huge…
But yeah, the xml needs to be optimized… But why even do XML? Especially for large classes doing something more compact would be more applicable right?
For example, a ByteArray compressed with ZLib…
There is a Java tool existing that works like this as well and it is quite good. I really like the idea of making custom rules using XPath. I will definitly optimize the XML. A lot of the CDATA structures will not be in there any ways. Currently I ignore(!) the formatting information — which is not what I want to do in the end but it helps me when writing the parser.
So basically I will fold/optimize the XML if needed. But first of all some more work has to be done :)
This is awesome stuff. I’ve been wanting something like this ever since I left the wonderful world of FxCop (any .NET guy probably knows what I’m talking about).
Can this be extended to eclipse and flex builder so that we might have syntax formatting tools?
I was planning to make this a command line tool. I especially want to use this as an svn hook. If anyone wants to volunteer its up to you.
Be careful Joa : I started writing a tool to validate AS2 syntax and typing a few years ago and following this path I ended up writing my own language ;)
Nicolas, I do not think that this was a bad path you went :) Actually I am really happy you did. But fortunately I do not have the time to do this ;)
And maybe you want to optimize my grammar file a little bit … :)
This looks really cool Joa, I’ll definitely be keeping an eye on how AS3V progresses – at the moment I use a rather optimistic ruby script to reformat code to match the Flex coding conventions.
When trying to build from source I’m getting this error:
Buildfile: build.xml
clean:
properties:
antlr:
[echo] Generating parser and lexer using antlr-3.1.1.jar …
[java] Exception in thread “main” java.lang.NoClassDefFoundError: org/antlr/Tool
BUILD FAILED
/Users/thijstriemstra/Sites/eclipse/as3v/java/build/build.xml:18: Java returned: 1
Thijs: Do you have ANTLR installed? There is a readme which describes how to set everything up. Or did you download ANTLR, created the build.properties and it failed?
Yeah I grabbed the .jar and created the build.properties as described in the readme but it then threw that error. This is on osx intel 10.5.5.
I saw your AS3.g in Google Code, dose that contain all the grammar of Actionscript?
And what is the use of AS3__.g?
It should contain the grammar for AS3 without RegExp/E4X — but it is incomplete. The other file has been comitted by mistake and is automatically generated by ANTLR.
I got it!
If the AS3V found a mistake, could the mistake line number be printed out?
If not ,how to realize that?
Yes but you would have to complete the grammer in that case. Actually ANTLR would return the information about the mistake.
I would like how can i use AS3V to validate my AsDoc, what steps i should fo them please.
I have download as3v.zip and extracted it but what can i do ten ???
I work with Eclipse
Thank you very much
Hello :)
Did As3V validate an AsDoc (Documentation) or not ???
What do you mean by validate an ASDoc?
Hello
Validate AsDoc means check the coverage (cover) of the AsDoc, do metrics to the AsDoc …
Is it possible with AS3V please ??
Or do you know other tool to do this ??
Thanks
AsDoc is the documentation? What would you expect from documentation coverage?
If you need a coverage tool for ActionScript then FlexCover might be an option for you. http://code.google.com/p/flexcover/