Beispiel #1
0
 public override void DoVisit(AST_Literal node)
 {
     if (node.type == ConstType.INT)
     {
         Console.Write(" (INT " + node.nval + ")");
     }
     else if (node.type == ConstType.FLT)
     {
         Console.Write(" (FLT " + node.nval + ")");
     }
     else if (node.type == ConstType.BOOL)
     {
         Console.Write(" (BOOL " + node.nval + ")");
     }
     else if (node.type == ConstType.STR)
     {
         Console.Write(" (STR '" + node.sval + "')");
     }
     else if (node.type == ConstType.NIL)
     {
         Console.Write(" (NULL)");
     }
 }
Beispiel #2
0
 int AddConstant(AST_Literal lt)
 {
     return(AddConstant(new Const(lt.type, lt.nval, lt.sval)));
 }
Beispiel #3
0
        public override void DoVisit(AST_Literal ast)
        {
            int literal_idx = AddConstant(ast);

            Emit(Opcodes.Constant, new int[] { literal_idx });
        }
Beispiel #4
0
 public abstract void DoVisit(AST_Literal ast);