Example #1
0
        public List<LispObject> EvaluateAll(List<LispObject> objs, Context context)
        {
            List<LispObject> evaluatedArgs = new List<LispObject>(objs.Count);
            for (int i = 0; i < objs.Count; i++)
            {
                LispObject arg = objs[i];
                LispObject evaluatedArg = this.EvaluateSingle(arg, context);
                evaluatedArgs.Add(evaluatedArg);
            }

            return evaluatedArgs;
        }
Example #2
0
        public LispObject EvaluateAllAndReturnLast(List<LispObject> objs, Context context)
        {
            // todo1[ak] check args

            LispObject result = null;

            for (int i = 0; i < objs.Count; i++)
            {
                result = this.EvaluateSingle(objs[i], context);
            }

            return result;
        }
Example #3
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;
        }
Example #4
0
        public Env()
        {
            _rootContext = new Context();

            //_functions = new Dictionary<string, Function>();
            //_constants = new Dictionary<string, Cell>();
            //_variables = new Dictionary<string, Cell>();

            //_specialForms = new Dictionary<string, SpecialForm>();

            _machine = new Machine(this);
            _evaluator = new Evaluator(this);
            _asmEngine = new AsmEngine();

            this.InitRoutines();

            //this.InitSpecialForms();
            //this.InitFunctions();
        }
Example #5
0
 public Context(Context parentContext)
     : this()
 {
     _parentContext = parentContext;
 }
Example #6
0
 public LispObject EvaluateObject(LispObject obj, Context context)
 {
     LispObject res = _evaluator.EvaluateSingle(obj, context);
     return res;
 }