Author:  Mike Atkinson Software
Release Notes
Download
Contributors

Previous Page

Software::ASTViever

Next Page

Abstract Syntax Tree viewer

This is a tool that shows the abstract syntax tree as found by the JavaStyle parser. (this might be slightly different from that which you would expect from the Java Language Specification).

public class X {
   public X() {
     int y = 1;
   }
}

has the tree

CompilationUnit
 TypeDeclaration
 ClassDeclaration
  UnmodifiedClassDeclaration
    ClassBody
    ClassBodyDeclaration
     ConstructorDeclaration
      FormalParameters
      BlockStatement
       LocalVariableDeclaration
        Type
         PrimitiveType
        VariableDeclarator
         VariableDeclaratorId
         VariableInitializer
          Expression
           ConditionalExpression
            ConditionalOrExpression
             ConditionalAndExpression
              InclusiveOrExpression
               ExclusiveOrExpression
                
                 EqualityExpression
                  InstanceOfExpression
                   RelationalExpression
                    ShiftExpression
                     AdditiveExpression
                      MultiplicativeExpression
                       UnaryExpression
                        UnaryExpressionNotPlusMinus
                         PostfixExpression
                          PrimaryExpression
                           PrimaryPrefix
                            Literal

performing the XPath query

//Literal

give the result

ASTLiteral at line 3

Previous Page

Last Modified: October 7, 2003

Previous Page