Class CompilationState


  • public class CompilationState
    extends java.lang.Object
    Temporary data used during construction and functions that fill it / use it. Result is impl CompiledST object.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) ErrorManager errMgr  
      (package private) CompiledST impl
      The compiled code implementation to fill in.
      (package private) int ip
      Track instruction location within impl.instrs array; this is next address to write to.
      (package private) StringTable stringtable
      Track unique strings; copy into CompiledST.strings after compilation.
      (package private) org.antlr.runtime.TokenStream tokens  
    • Constructor Summary

      Constructors 
      Constructor Description
      CompilationState​(ErrorManager errMgr, java.lang.String name, org.antlr.runtime.TokenStream tokens)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int defineString​(java.lang.String s)  
      void emit​(short opcode)  
      void emit​(org.antlr.runtime.tree.CommonTree opAST, short opcode)  
      void emit1​(org.antlr.runtime.tree.CommonTree opAST, short opcode, int arg)  
      void emit1​(org.antlr.runtime.tree.CommonTree opAST, short opcode, java.lang.String s)  
      void emit2​(org.antlr.runtime.tree.CommonTree opAST, short opcode, int arg, int arg2)  
      void emit2​(org.antlr.runtime.tree.CommonTree opAST, short opcode, java.lang.String s, int arg2)  
      protected void ensureCapacity​(int n)  
      void func​(org.antlr.runtime.Token templateToken, org.antlr.runtime.tree.CommonTree id)  
      void indent​(org.antlr.runtime.tree.CommonTree indent)  
      void insert​(int addr, short opcode, java.lang.String s)  
      void refAttr​(org.antlr.runtime.Token templateToken, org.antlr.runtime.tree.CommonTree id)  
      void setOption​(org.antlr.runtime.tree.CommonTree id)  
      void write​(int addr, short value)  
      static void writeShort​(byte[] memory, int index, short value)
      Write value at index into a byte array highest to lowest byte, left to right.
      • Methods inherited from class java.lang.Object

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

      • impl

        CompiledST impl
        The compiled code implementation to fill in.
      • ip

        int ip
        Track instruction location within impl.instrs array; this is next address to write to. Byte-addressable memory.
      • tokens

        org.antlr.runtime.TokenStream tokens
    • Constructor Detail

      • CompilationState

        public CompilationState​(ErrorManager errMgr,
                                java.lang.String name,
                                org.antlr.runtime.TokenStream tokens)
    • Method Detail

      • defineString

        public int defineString​(java.lang.String s)
      • refAttr

        public void refAttr​(org.antlr.runtime.Token templateToken,
                            org.antlr.runtime.tree.CommonTree id)
      • setOption

        public void setOption​(org.antlr.runtime.tree.CommonTree id)
      • func

        public void func​(org.antlr.runtime.Token templateToken,
                         org.antlr.runtime.tree.CommonTree id)
      • emit

        public void emit​(short opcode)
      • emit

        public void emit​(org.antlr.runtime.tree.CommonTree opAST,
                         short opcode)
      • emit1

        public void emit1​(org.antlr.runtime.tree.CommonTree opAST,
                          short opcode,
                          int arg)
      • emit2

        public void emit2​(org.antlr.runtime.tree.CommonTree opAST,
                          short opcode,
                          int arg,
                          int arg2)
      • emit2

        public void emit2​(org.antlr.runtime.tree.CommonTree opAST,
                          short opcode,
                          java.lang.String s,
                          int arg2)
      • emit1

        public void emit1​(org.antlr.runtime.tree.CommonTree opAST,
                          short opcode,
                          java.lang.String s)
      • insert

        public void insert​(int addr,
                           short opcode,
                           java.lang.String s)
      • write

        public void write​(int addr,
                          short value)
      • ensureCapacity

        protected void ensureCapacity​(int n)
      • indent

        public void indent​(org.antlr.runtime.tree.CommonTree indent)
      • writeShort

        public static void writeShort​(byte[] memory,
                                      int index,
                                      short value)
        Write value at index into a byte array highest to lowest byte, left to right.