AS3V

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.

23 Comments

  1. Posted Oct 6, 2008 at 2:54 pm | Permalink

    That’s a whoooooole lot of XML for one simple class.

    Have you run it through the Flex framework yet? *covers eyes*

  2. Posted Oct 6, 2008 at 5:47 pm | Permalink

    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).

  3. Posted Oct 6, 2008 at 10:47 pm | Permalink

    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!

  4. Posted Oct 7, 2008 at 9:12 am | Permalink

    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…

  5. Posted Oct 7, 2008 at 10:18 am | Permalink

    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 :)

  6. Posted Oct 7, 2008 at 10:33 pm | Permalink

    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?

  7. Posted Oct 8, 2008 at 10:03 am | Permalink

    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.

  8. Posted Oct 11, 2008 at 1:40 pm | Permalink

    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 ;)

  9. Posted Oct 11, 2008 at 2:32 pm | Permalink

    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 … :)

  10. Posted Oct 14, 2008 at 11:52 pm | Permalink

    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.

  11. Posted Oct 15, 2008 at 11:33 am | Permalink

    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 …
    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

  12. Posted Oct 15, 2008 at 1:53 pm | Permalink

    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?

  13. Posted Oct 22, 2008 at 2:17 am | Permalink

    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.

  14. Annie
    Posted Feb 6, 2009 at 1:55 am | Permalink

    I saw your AS3.g in Google Code, dose that contain all the grammar of Actionscript?

  15. Annie
    Posted Feb 6, 2009 at 2:00 am | Permalink

    And what is the use of AS3__.g?

  16. Posted Feb 7, 2009 at 9:30 pm | Permalink

    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.

  17. Annie
    Posted Feb 10, 2009 at 10:07 pm | Permalink

    I got it!

    If the AS3V found a mistake, could the mistake line number be printed out?

    If not ,how to realize that?

  18. Posted Feb 11, 2009 at 11:53 am | Permalink

    Yes but you would have to complete the grammer in that case. Actually ANTLR would return the information about the mistake.

  19. Nini7016
    Posted Mar 3, 2010 at 12:27 pm | Permalink

    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

  20. Nini7016
    Posted Mar 5, 2010 at 5:32 pm | Permalink

    Hello :)

    Did As3V validate an AsDoc (Documentation) or not ???

  21. Posted Mar 6, 2010 at 12:32 am | Permalink

    What do you mean by validate an ASDoc?

  22. Nini7016
    Posted Mar 8, 2010 at 2:59 pm | Permalink

    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

  23. Posted Mar 10, 2010 at 1:38 pm | Permalink

    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/

3 Trackbacks

  1. [...] > AS3V at blog.joa-ebert.com – Blog of Joa Ebert [...]

  2. [...] September 2008 I started working on a tool called AS3V. The goal of AS3V was to parse source code and to check the code against a set of rules. My main [...]

  3. [...] Ebert was first to the market with AS3V and I quickly wired it up to run with TextMate. AS3V is 90% to 95% there, but still needs a couple [...]

Post a Comment

Your email is never shared. Required fields are marked *

*
*