Esempio n. 1
0
        public static void Main(string[] args)
        {
            var ns         = typeof(Program).Assembly.GetName().Name;
            var replStream = typeof(Program).Assembly.GetManifestResourceStream(ns + ".repl.ss");

            string repl;

            using (var reader = new StreamReader(replStream))
            {
                repl = reader.ReadToEnd();
            }

            var vm   = new SchemeVM();
            var inst = SchemeCompiler.Compile(vm, repl);

            vm.Execute(inst);
        }
Esempio n. 2
0
        public static ISExpression Evaluate(IEnumerable <ISExpression> args)
        {
            var body = args.First();
            var env  = args.Skip(1).First();

            var vm = new SchemeVM();

            vm.E = (Environment)env;

            try
            {
                var inst = SchemeCompiler.Compile(vm, body);
                var ret  = vm.Execute(inst);
                return(ret);
            }
            catch (Exception e)
            {
                Console.WriteLine("ERROR: " + e.Message);
                return(AtomHelper.Nil);
            }
        }