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)"); } }
int AddConstant(AST_Literal lt) { return(AddConstant(new Const(lt.type, lt.nval, lt.sval))); }
public override void DoVisit(AST_Literal ast) { int literal_idx = AddConstant(ast); Emit(Opcodes.Constant, new int[] { literal_idx }); }
public abstract void DoVisit(AST_Literal ast);