Пример #1
0
        static Object eval(Object[] f)
        {
            Object p = f[0];
            Code   c = Precompiler.compile(p);

            return(c.run(f, null));
        }
Пример #2
0
        public static Object eval0(string str)
        {
            ExtendedReader r      = new ExtendedReader(new System.IO.StringReader(str));
            Object         o      = aread(r);
            Object         result = (Precompiler.compile(o).run(null, null));

            return(result);
        }
Пример #3
0
        public MakeSequence(Pair p)
        {
            int l = p.length();

            sqn = new Code[l];
            Pair pp = p;

            for (int i = 0; i < l; i++)
            {
                Object h = pp.car;
                pp     = pp.pcdr;
                sqn[i] = Precompiler.compile(h);
            }
        }
Пример #4
0
        public MakeApp(Pair p)
        {
            int l = p.length();

            parts = new Object[l];
            Pair pp = p;

            for (int i = 0; i < l; i++)
            {
                Object h = pp.car;
                pp = pp.pcdr;
                if (h is Pair)
                {
                    parts[i] = Precompiler.compile(h);
                }
                else
                if (h is Symbol)
                {
                    Symbol sh = (Symbol)h;
                    Object test;
                    Precompiler.symbols.TryGetValue(sh, out test);
                    if (test == null && !Precompiler.symbols.ContainsKey(sh))
                    {
                        if (Runtime.comp_hash[sh.v] != null)
                        {
                            test = Runtime.makedelegate(sh);
                        }
                        else
                        {
                            Console.WriteLine("sclmglobal name " + sh.v + " undefined");
                        }
                    }
                    parts[i] = test;
                }
                else
                {
                    parts[i] = h; // optimize constants
                }
            }
        }