public Compiler(SymbolTable symbolTable) { _ins = new List <int>(); _bytecode = new global::VM.Bytecode(); _symbolTable = symbolTable; _errors = new List <IError>(); }
public Compiler(ILGenerator gen, SymbolTable symbolTable) { _bytecode = new global::VM.Bytecode(); _gen = gen; _symbolTable = symbolTable; _msilHelper = new CodeGenHelper(); _globals = _msilHelper.AllocArray <int[]>(_gen, 200); _stack = _msilHelper.AllocStack <int>(_gen); // Generic result variable for Pop, etc. _result = _gen.DeclareLocal(typeof(int)); // The tmp's are needed for storing values temporarily (mostly from/onto stack) _tmp1 = _gen.DeclareLocal(typeof(int)); _tmp2 = _gen.DeclareLocal(typeof(int)); _bp = _gen.DeclareLocal(typeof(int)); _labels = new Dictionary <int, Label>(); _errors = new List <IError>(); }