Пример #1
0
            protected void addStandardLabels()
            {
                builder.SetLabel("StandardRuntime.Nil", StandardRuntime.Nil);
                builder.SetLabel("StandardRuntime.False", StandardRuntime.False);
                builder.SetLabel("StandardRuntime.True", StandardRuntime.True);
                builder.SetLabel("Environment.NewLine", new Cell(Environment.NewLine));
                // Add CellType.[Name] definitions
                CellType cellType = CellType.SYMBOL;

                foreach (var kv in cellType.GetKeyValues <int>())
                {
                    builder.SetLabel("CellType." + kv.Key, kv.Value);
                }
                OpCode opcode = OpCode.NOP;

                // Add OpCodes (no prefix)
                foreach (var kv in opcode.GetKeyValues <int>())
                {
                    builder.SetLabel(kv.Key, kv.Value);
                }
            }
Пример #2
0
        public static void AddGlobals(SchemeEnvironment e)
        {
            e.Insert(False.Value, False); e.Insert(True.Value, True); e.Insert(Nil.Value, Nil);
            e.Insert("+", new Cell(Plus)); e.Insert("-", new Cell(Minus));
            e.Insert("*", new Cell(Multiply)); e.Insert("/", new Cell(Divide));
            e.Insert("<", new Cell(LessThan)); e.Insert("<=", new Cell(LessThanEqual));
            e.Insert(">", new Cell(GreaterThan)); e.Insert(">=", new Cell(GreaterThanEqual));
            e.Insert("=", new Cell(Equal)); e.Insert("==", new Cell(Equal));
            e.Insert("print", new Cell(Print));
            e.Insert("head", new Cell(Head)); e.Insert("tail", new Cell(Tail));
            e.Insert("null?", new Cell(Nullp)); e.Insert("list", new Cell(List));
            e.Insert("cons", new Cell(Cons)); e.Insert("append", new Cell(Append));
            e.Insert("length", new Cell(Length));

            // Add CellType.[Name] definitions
            CellType cellType = CellType.SYMBOL;

            foreach (var kv in cellType.GetKeyValues <int>())
            {
                e.Insert("CellType." + kv.Key, new Cell(kv.Value));
            }
        }