public void CreateStream()
        {
            var op0 = new Operand(OperandType.Literal, 1, 0);
            var op1 = new Operand(OperandType.Literal, 1, 0);

            var runtimeStream = new InstrucStream(
                new Instruction(OpCode.ADD, 1, op0, op1),
                new Instruction(OpCode.MOV, 2, op0, op1)
                );

            Assert.AreEqual(2, runtimeStream.Size);
        }
Example #2
0
        public Runnable GetScript(Instruction[] instructions, int secondIndex)
        {
            var stream = new InstrucStream(instructions);

            var function = new Function(Function.MainName, 0);
            var dofunction = new Function("Do", secondIndex);

            var ftable = new FunctionTable
                             {
                                 { Function.MainName, function },
                                 { "Do", dofunction}
                             };

            return new Runnable(stream, ftable);
        }
Example #3
0
 public Runnable(InstrucStream instStream, FunctionTable fTable)
 {
     Setup(instStream, fTable, null);
 }
Example #4
0
 public Runnable(InstrucStream instStream, FunctionTable fTable, SymbolTable symbolTable)
 {
     Setup(instStream, fTable, symbolTable);
 }
Example #5
0
        private void Setup(InstrucStream instStream, FunctionTable fTable, SymbolTable symbolTable)
        {
            stream = instStream;
            functionTable = fTable;

            if (functionTable.ContainsKey(Function.MainName))
            {
                mainFunction = functionTable[Function.MainName];
            }

            ScriptSymbolTable = SymbolTable.CreateFor(symbolTable);

            RuntimeStack = new RuntimeStack();

            ParamStack = new ParamStack();
        }