Exemple #1
0
        public Routine Build()
        {
            if (!this.IsFinished)
            {
                throw new ApplicationException(); // todo2[ak]
            }

            if (_result == null)
            {
                _result = this.BuildImpl();
            }

            return _result;
        }
Exemple #2
0
        public LispObject EvaluateSingle(LispObject obj, Context context)
        {
            // todo1[ak] check args

            Machine machine = this.Env.Machine;

            Routine main = new Routine("main", new Instruction[] { new EvalInstruction(), });

            machine.Load(main);
            machine.SetRegisterValue(RegisterName.EvForm, obj);

            machine.Exec();

            LispObject res = machine.GetRegisterValue(RegisterName.EvRes);

            return res;
        }
Exemple #3
0
 private Routine BuildImpl()
 {
     Routine routine = new Routine(this.Name, this.CreateInstructions());
     return routine;
 }
Exemple #4
0
 internal Process(Routine routine)
 {
     this.Routine = routine;
 }
Exemple #5
0
        private void GoToRoutine(Routine callee)
        {
            ClrObject obj = new ClrObject
            {
                Value = _currentProcess,
            };

            this.Push(obj);
            _gotos++;

            _currentProcess = new Process(callee);
        }
Exemple #6
0
        public void Load(Routine routine)
        {
            //_callStack.Clear();
            _currentProcess = new Process(routine);
            _stack.Clear();
            _gotos = 0;

            this.ClearRegisters();
        }