Class AstNode

java.lang.Object
io.jawk.frontend.AstNode

public abstract class AstNode extends Object
A Jawk abstract syntax tree node. This provides an appropriate public interface to the abstract syntax tree.
Author:
Danny Daglas
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Creates an abstract syntax tree node.
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract void
    Dump a meaningful text representation of this abstract syntax tree node to the output (print) stream.
    abstract int
    Appends tuples to the AwkTuples list for this abstract syntax tree node.
    abstract void
    Apply semantic checks to this node.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • AstNode

      protected AstNode()
      Creates an abstract syntax tree node.
  • Method Details

    • dump

      public abstract void dump(PrintStream ps)
      Dump a meaningful text representation of this abstract syntax tree node to the output (print) stream. Either it is called directly by the application program, or it is called by the parent node of this tree node.
      Parameters:
      ps - The print stream to dump the text representation.
    • semanticAnalysis

      public abstract void semanticAnalysis()
      Apply semantic checks to this node. The default implementation is to simply call semanticAnalysis() on all the children of this abstract syntax tree node. Therefore, this method must be overridden to provide meaningful semantic analysis / checks.
    • populateTuples

      public abstract int populateTuples(AwkTuples tuples)
      Appends tuples to the AwkTuples list for this abstract syntax tree node. Subclasses must implement this method.

      This is called either by the main program to generate a full list of tuples for the abstract syntax tree, or it is called by other abstract syntax tree nodes in response to their attempt at populating tuples.

      Parameters:
      tuples - The tuples to populate.
      Returns:
      The number of items left on the operand stack after these tuples have executed.