private void ASNUM() { DataNeeds(1); var val = DATA.Pop(); DATA.Push(SYMTAB.CreateSymbol(SymbolType.DOUBLE, double.Parse(val.Value.ToString()))); }
private void ARITHOP() { Needing(new SymbolType[] { SymbolType.STRING, SymbolType.DOUBLE, SymbolType.DOUBLE }); var op = DATA.Pop(); var lh = DATA.Pop(); var rh = DATA.Pop(); switch (op.Value.ToString()) { case "+": DATA.Push(SYMTAB.CreateSymbol(SymbolType.DOUBLE, (double)lh.Value + (double)rh.Value)); break; case "-": DATA.Push(SYMTAB.CreateSymbol(SymbolType.DOUBLE, (double)lh.Value - (double)rh.Value)); break; case "*": DATA.Push(SYMTAB.CreateSymbol(SymbolType.DOUBLE, (double)lh.Value * (double)rh.Value)); break; case "/": DATA.Push(SYMTAB.CreateSymbol(SymbolType.DOUBLE, (double)lh.Value / (double)rh.Value)); break; } }
private void CHR() { DataNeeds(1); Check(0, SymbolType.DOUBLE); var chr = DATA.Pop(); DATA.Push(SYMTAB.CreateSymbol(SymbolType.STRING, (char)((int)chr.Value))); }