internal Process LaunchProcess(Method m) { Process p = new Process(); p.Call(m); running.Enqueue(p); return p; }
public Method Compile(IBlock b, bool mainProgram) { List<Instruction> instructions = CompileBlockToInstructions(b, mainProgram); Method ret = new Method(); ret.Instructions = instructions.ToArray(); ret.Arity = 0; ret.PrepareLabels(); return ret; }
public Method DefineMethod(ProcDefBlock b, BlockStack stack) { // 'stack' is a BlockStack whose first element (#0) is a ProcDefBlock, the same as 'b' Method ret = new Method(); List<Instruction> instructions = new List<Instruction>(); string[] argNames = b.GetArgNames(); for (int i = 0; i < argNames.Length; ++i) { instructions.Add(new PopLocal(vm, argNames[i])); } for(int i=1; i<stack.Count; ++i) instructions.AddRange(CompileBlockToInstructions(stack[i], false)); instructions.Add(new Push(vm, null)); instructions.Add(new Ret(vm)); ret.Instructions = instructions.ToArray(); ret.Arity = argNames.Length; ret.PrepareLabels(); return ret; }
internal void DefineMethod(string name, Method m) { methods[name] = m; }
public Frame(Method method) { this.Method = method; IP = 0; }
public Call(VM vm, Method callee) : base(vm) { this.callee = callee; }