Package iota

Class IAST

java.lang.Object
iota.IAST
Direct Known Subclasses:
ICompilationUnit, IFormalParameter, IMethodDeclaration, IStatement

abstract class IAST extends Object
IAST is the abstract superclass of all nodes in the abstract syntax tree (AST).
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    Current compilation unit (set in ICompilationUnit()).
    protected int
    Line in which the source for the AST was found.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    IAST(int line)
    Constructs an AST node the given its line number in the source file.
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract IAST
    analyze(Context context)
    Performs second phase of semantic analysis on this AST and returns the (possibly modified) AST.
    abstract void
    Performs code generation for this AST.
    int
    Returns the line in which the source for the AST was found.
    void
    preAnalyze(Context context, CLEmitter partial)
    Performs first phase of semantic analysis on this AST.
    void
    Stores information about this AST in JSON format.

    Methods inherited from class java.lang.Object

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

    • compilationUnit

      public static ICompilationUnit compilationUnit
      Current compilation unit (set in ICompilationUnit()).
    • line

      protected int line
      Line in which the source for the AST was found.
  • Constructor Details

    • IAST

      protected IAST(int line)
      Constructs an AST node the given its line number in the source file.
      Parameters:
      line - line in which the source for the AST was found.
  • Method Details

    • line

      public int line()
      Returns the line in which the source for the AST was found.
      Returns:
      the line in which the source for the AST was found.
    • preAnalyze

      public void preAnalyze(Context context, CLEmitter partial)
      Performs first phase of semantic analysis on this AST.
      Parameters:
      context - the environment (scope) in which code is pre-analyzed.
      partial - the code emitter.
    • analyze

      public abstract IAST analyze(Context context)
      Performs second phase of semantic analysis on this AST and returns the (possibly modified) AST.
      Parameters:
      context - the environment (scope) in which code is analyzed.
      Returns:
      the (possibly modified) AST.
    • codegen

      public abstract void codegen(CLEmitter output)
      Performs code generation for this AST.
      Parameters:
      output - the code emitter.
    • toJSON

      public void toJSON(JSONElement json)
      Stores information about this AST in JSON format.
      Parameters:
      json - the JSON emitter.