Package examples

Class ASTExample

java.lang.Object
examples.ASTExample

public class ASTExample extends Object
Shows how to use Introspector to represent an Abstract Syntax Tree (AST) used in most compilers.
  • Constructor Details

    • ASTExample

      public ASTExample()
  • Method Details

    • createTree

      public static ASTNode createTree()

      This method creates the AST for the following program:

       read a,b;
       a = (-b+3)*c;
       write a,c*2;
       
      Returns:
      the root of the AST
    • main

      public static void main(String[] args)
      Example main program
      Parameters:
      args - no params are required